is this fucntion still revavant???
| From: | (Ed Blincoe) | Date: | Fri, 05 May 2000 21:19:54 +0000 |
| Subject: | is this fucntion still revavant??? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18448@lists.php.net to get a copy of this message | ||
Hi
I last used this function about 18 months ago using php2, and I'm trying to get it working now,
but the file pointer is not being set, any suggestions appreciated.
php2 function
function wc_conn $host, $port, $file
(
$function = "GET"; /* Type of HTTP */
$request = "$function $file HTTP/1.0\n\n";
$fp = fsockopen($host,$port);
fputs($fp, $request);
$eof = feof($fp);
$beyondheader = 0;
while($beyondheader==0 && $eof==0) {
$fromserver = fgets($fp, 1024);
if (!ereg("^HTTP", $fromserver) && !ereg(".+: .+", $fromserver)) {
$beyondheader=1;
}
$eof = feof($fp);
}
while($eof==0) {
$fromserver = fgets($fp, 1024);
$string += $fromserver;
$eof = feof($fp);
}
return $string;
); /* End function */
what I'm using in php3,
function wc_conn ($host, $port, $files)
{
$functions = "GET"; /* Type of HTTP */
$request = "$functions HTTP/1.0\n\n";
$fp = fsockopen($host,$port, &$errno, &$errstr, 30);
fputs($fp, $request);
$eof = feof($fp);
$beyondheader = 0;
while($beyondheader==0 && $eof==0) {
$fromserver = fgets($fp, 1024);
if (!ereg("^HTTP", $fromserver) && !ereg(".+: .+", $fromserver)) {
$beyondheader=1;
}
$eof = feof($fp);
}
while($eof==0) {
$fromserver = fgets($fp, 1024);
$string += $fromserver;
$eof = feof($fp);
}
return $string;
}; /* End function */
Ed Blincoe
Senior Analyst Programmer
Ego Maniacs.net LTD
ed@egomaniacs.net
020 7739 5442