curl not downloading proper file

Kajetan Krykwiński <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <[email protected]>
I want to download XML file, e.g
http://wojtek1992u.wrzuta.pl/xml/plik/0gn8Pwxjydv/nirvana_-_smells_like_teen_spirit.
When I use curl for Windows, everything's going right (curl - G
<address>). But if I'm trying to do the same, I've got other response (like
that: http://wojtek1992u.wrzuta.pl/xml/plik/0gn8Pwxjy - error - file not
found). This is PHP code i'm using:

<?php
$curl = curl_init('
http://wojtek1992u.wrzuta.pl/xml/plik/0gn8Pwxjydv/nirvana_-_smells_like_teen_spirit'<http://wojtek1992u.wrzuta.pl/xml/plik/0gn8Pwxjydv/nirvana_-_smells_like_teen_spirit%27>
);

curl_setopt($curl, CURLOPT_HEADERFUNCTION, 'dbg_curl_data');
curl_setopt($curl, CURLOPT_WRITEFUNCTION, 'dbg_curl_data');
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'curl/7.21.0 (i386-pc-win32)
libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.5 libidn/1.18 libssh2/1.2.6');

curl_exec($curl);

echo '<fieldset><legend>request headers</legend>
  <pre>', htmlspecialchars(curl_getinfo($curl, CURLINFO_HEADER_OUT)),
'</pre>
</fieldset>';

echo '<fieldset><legend>response</legend>
  <pre>', htmlspecialchars(dbg_curl_data(null)), '</pre>
</fieldset>';

function dbg_curl_data($curl, $data=null) {
  static $buffer = '';

  if ( is_null($curl) ) {
    $r = $buffer;
    $buffer = '';
    return $r;
  }
  else {
    $buffer .= $data;
    return strlen($data);
  }
}

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.