Tu masz kod:
<?php
$postdata="returnto=%2Fpremiuminfo.html&user=uzytkownik&pass=haslo&=Login";
$curl = curl_init('http://hotfile.com/login.php');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
$xxx = curl_exec($curl);
curl_close($curl);
$url='http://uzytkownik:haslo@hotfile.com/dl/4050134/3b7e371/Pomoce.do.robienia.aukcji.na.Allegro.rar';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686; pl; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3');
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_NOBODY, 1);
curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
curl_setopt($curl, CURLOPT_COOKIEJAR, "cookiefile"); # SAME cookiefile
$xxx = curl_exec($curl);
$info = curl_getinfo($curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($curl);
?>
Oczywiście słowa "uzytkownik" i "haslo" zamieniam na prawidłowe.
Co do nagłówków to czytałem i to mnie właśnie dziwi, że na każdym serwerze co miałem okazję sprawdzić dostaję:
Kod
HTTP/1.1 302 Found Cache-Control: no-cache, must-revalidate Expires: Sat, 26 Jul 1997 05:00:00 GMT Set-Cookie: ip=77.55; path=/; domain=.hotfile.com Location: http://s295.hotfile.com/get/58706761f2f30d226edbf97fb5b48bf5ef8b4ddc/4c2a6ba1/1/ee19bd8483772e63/3dccd6/2462976/Pomoce.do.robienia.aukcji.na.Allegro.rar Content-type: text/html Date: Tue, 29 Jun 2010 21:54:41 GMT Server: lighttpd/1.4.20
a na tym serwerze co nie działa pobieranie dostaję:
Kod
HTTP/1.1 200 OK Cache-Control: no-cache, must-revalidate Expires: Sat, 26 Jul 1997 05:00:00 GMT Set-Cookie: lastdl=%2Fdl%2F4050134%2F3b7e371%2FPomoce.do.robienia.aukcji.na.Allegro.rar; expires=Thu, 29-Jul-2010 21:56:48 GMT; path=/; domain=.hotfile.com Content-type: text/html Date: Tue, 29 Jun 2010 21:56:48 GMT Server: lighttpd/1.4.20
Na tym serwerze co nie działa pobieranie jest świeżo zainstalowany i to konfigurację przeprowadzała mi firma od tego. Błędu w skrypcie nie widzę, więc coś chyba jeszcze jest nie tak z serwerem. Od razu mówię, że już po googlach szukałem.