Hi, I’m creating a little server status checker, and looks like the following:
[php]<?php
header(‘Content-type: image/png’);
$socket = @fsockopen(‘http://www.google.com’);
if($socket) {
fclose($socket);
readfile(‘on.png’);
exit;
} else {
readfile(‘off.png’);
exit;
}
?>[/php]
The above returns the “off.png” image all the time. Of course, this script will be using my own IP, but I used google because I was sure it would return the “on.png” image, but it didn’t.
Could anyone point out what I’m doing wrong? I literally fumbled though those few lines and it seems I can’t get it to work.