Bug #8440 Updated: fopen on a url returns "success" as an error

From: Date: Sun, 21 Apr 2002 16:40:19 +0000
Subject: Bug #8440 Updated: fopen on a url returns "success" as an error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-5508@lists.php.net to get a copy of this message
ID: 8440 Updated by: mathieu@hoo-la.com Reported By: david@php.net Status: Closed Bug Type: HTTP related Operating System: Debian Linux 2.2.14 PHP Version: 4.0.4pl1 New Comment: you can open a remote file with the fsockopen command I use this function when I had this problem /**********************************************************/ function sendToHost($host,$method,$path,$data,$useragent=0) { // Supply a default method of GET if the one passed was empty if (empty($method)) $method = 'GET'; $method = strtoupper($method); $fp = fsockopen($host,80); if ($method == 'GET') $path .= '?' . $data; fputs($fp, "$method $path HTTP/1.1\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Content-length: " . strlen($data) . "\n"); if ($useragent) fputs($fp, "User-Agent: MSIE\n"); fputs($fp, "Connection: close\n\n"); if ($method == 'POST') fputs($fp, $data); while (!feof($fp)) $buf .= fgets($fp,128); fclose($fp); return $buf; } /**********************************************************/ Previous Comments: ------------------------------------------------------------------------ [2002-03-17 16:13:04] jason@unrealtournament.org Or, just as good, is there an alternate way to open a remote file? ------------------------------------------------------------------------ [2002-03-17 16:07:56] jason@unrealtournament.org Uggh...is there any way to fix it without waiting a month? ------------------------------------------------------------------------ [2002-03-17 15:34:47] derick@php.net In about a month. Derick ------------------------------------------------------------------------ [2002-03-17 15:24:59] jason@unrealtournament.org When will the 4.2.x branch be out though? ------------------------------------------------------------------------ [2002-03-16 18:02:03] derick@php.net You can try a snapshot from snaps.php.net, I beilieve it's fixed in the PHP 4.2.x branch. Derick ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/8440 -- Edit this bug report at http://bugs.php.net/?id=8440&edit=1

« previous php.bugs (#5508) next »