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.