|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-06-28 13:00 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
Description: ------------ fgets fread can't read long date in fsockopen php4.3.2 ever can't use any remote file function php4.3.1 everything is okay whatever $len is set , it can't read any long date but everything is okay in php4.3.1 or older there are so many big problem with remote file function in php4.3.2 . I post this bug for twice , I am not kitting . function remote_request($host, $path,$port=80,$method="GET",$len=2048,$user="",$pass="") { $agent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"; $fp = fsockopen($host,$port,$errno, $errstr, 6); socket_set_timeout($fp, 18); if (!$fp) { echo "$err_msg ($err_num)<br>\n"; } else { $auth = $user.":".$pass ; $string=base64_encode($auth); fputs($fp,"$method $path HTTP/1.1 \r\n"); fputs($fp,"Host: $host \r\n"); fputs($fp,"Accept-Language: zh-cn \r\n"); //fputs($fp,"charset=GBK"); if($pass)fputs($fp, "Authorization: Basic ".$string."\r\n"); fputs($fp, "User-Agent: ".$agent."\r\n"); if($pass)fputs($fp, "Content-type: application/x-www-form-urlencoded \r\n"); //fputs($fp, "Cache-Control: no-cache\r\n"); fputs($fp, "Connection: close\r\n"); fputs($fp, "\r\n"); $reply=fread($fp,$len); fclose($fp); } return $reply; }