View Single Post
Old 01-29-2013, 09:02 PM   PM User | #10
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Just the two expected?
Replace this:
PHP Code:
        $sStatus = !empty($sResult) ? $sResult $sStatus;
        
fclose($fh); 
With this:
PHP Code:
list($header$body) = explode("\r\n\r\n"$sResult);
$aHeaders explode("\r\n"$header); // optional, can scanf off of the regular string
sscanf($aHeaders[0], 'HTTP/1.1 %d %s'$code$httpStatus);
if (
$code == 200)
{
    
// Now, this is what I'm not sure about.  The status you have in the directories match this, but I'm not sure why it differs from the file_get_content.
    
$aBody explode("\n"$body);
    
$sStatus = isset($aBody[1]) ? $aBody[1] : '00';
}
fclose($fh); 
And near the top set the default value of $sStatus to '00' as a string.

Try that.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
iman (01-30-2013)