Jump to content

Random characters appearing in content from a URL


cgm

Recommended Posts

Hey folks....

 

I have a script that downloads an HTML page, but for some reason I get random characters appearing every now and then, generally 3 or 4 random alphanumeric characters surrounded by newlines. The most obvious (for me anyway) in the page that is being loaded by the script below is:

 

<a href="http://www.promo-so
b55
urcing.net"><strong>www.p....

 

The new lines and "b55" are not there when I view the page or get the whole file in one go, only when I try getting the file in bits.

 

Script as follows:

 

$fp = @fsockopen("www.buyking.co.uk", 80, $errno, $errstr, 30);
$header =  "GET / HTTP/1.1\r\n".
           "Host: www.buyking.co.uk\r\n".
           "User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)\r\n".
           "Accept: */*\r\n".
           "Connection: close\r\n".
           "Referer: http://www.buyking.co.uk/\r\n\r\n";
fputs($fp, $header);
$buffer = fgetc($fp);
$response = "";
while (!feof($fp)) {
        $response .= $buffer;
        $buffer = fgetc($fp);
}
$response .= $buffer;
echo $response;

 

Thanks in advance for any suggestions,

 

Chris

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.