daleader Posted March 13, 2007 Report Share Posted March 13, 2007 (edited) Probl�“ma sekojoša, nesūtās neviens headeris. Kas var�“tu būt par probl�“mu?? Esmu izp�“tījis php manuāli krustām šķ�“rsām, neesmu neko atradis. <?php $fp = fsockopen("62.85.8.220", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: 62.85.8.220\r\n"; $out .= "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050804 Firefox/1.0.6\r\n"; $out .= "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n"; $out .= "Accept-Language: lv,en-us;q=0.7,en;q=0.3\r\n"; $out .= "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"; $out .= "Keep-Alive: 300\r\n"; $out .= "Connection: keep-alive\r\n"; $out .= "Referer: [url="http://62.85.8.220\r\n";"]http://62.85.8.220\r\n";[/url] $out .= "Cookie: name_cookie=value_cookie; path=\; Friday, 13-Jan-08 12:00:00 GMT\r\n"; $out .= "Connection: Close\r\n\r\n"; $rinda=''; fputs($fp, $out); while (!feof($fp)) { echo fgets($fp, 2048); } fclose($fp); } ?> Paldies par atbildi jau iepriekš. Edited March 13, 2007 by daleader Link to comment Share on other sites More sharing options...
Exzo Posted March 18, 2007 Report Share Posted March 18, 2007 Kaut kad pasen cīnījos ar fsockopen. Tā padarīšana ir visai jūtīga uz headeru kļūdām, tajā skaitā arī uz "\r\n" skaitu katras konkrētās headera rindas beigās (RFC 2616) Sākumam novienkāršo līdz minimumam: $header = "GET $path HTTP/1.0\r\n"; $header .= "Host: $host\r\n"; $header .= "$useragent\r\n"; $header .= "Connection: Close\r\n\r\n"; Ja arī tad nestrādā, tad skaties kas tev notiek ar $path un $host Link to comment Share on other sites More sharing options...
Recommended Posts