GEt Command
| From: | Clayton Dukes | Date: | Tue, 17 Jul 2001 18:07:34 +0000 |
| Subject: | GEt Command | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-58306@lists.php.net to get a copy of this message | ||
Does anyone have a simple script that will GET a web page and return the reply?
Something like this:
function getpage($host, $path, getstr) {
$getstr="whatever\r\n";
$host=www.whatever.com;
$hdr=sprintf("GET $getstr", $path);
$hdr .="Content-type: application/x-www-form-urlencoded\r\n";
$hdr .="Accept: text/html\r\nAccept: text/plain\r\n";
$hdr .="User-Agent: Mozilla/1.0\r\n\r\n";
$fp = fsockopen($host , 80, &$errno, &$errstr, 45);
if (!$fp) {
echo "$host open error: $errstr $errno .\n";
return(0);
} else {
fputs($fp,$hdr.$poststr);
return($fp);
}
}
while (!feof($fp)) {
$buff=fgets($fp, 1024);
//dofoo($buff);
echo "$buff";
}
fclose($fp);
TIA!
Clayton Dukes
CCNA, CCDA, CCDP, CCNP
(c) 904.477.7825
(h) 904.292.1881
Download Free Essays, Term Papers and Cisco Training from http://www.gdd.net