Hi!
First of all, congrats for your excelent service!
Now, my problem is the following:
I have this script:
And when I render the page, it appears this error:
Warning: fsockopen() [function.fsockopen]: unable to connect to 83.149.85.11:7171 (Connection timed out) in /home/utibia/public_html/uptime.php on line 4
Help please
First of all, congrats for your excelent service!
Now, my problem is the following:
I have this script:
PHP:
<?php
$info = chr(6).chr(0).chr(255).chr(255).'info';
//making socket connection to an ip and port 7171
$sock = fsockopen('83.149.85.11', 7171, $errno, $errstr, 1);
if ($sock)
{
//writes the info gotten by sending the server packet.
fwrite($sock, $info);
$data='';
while (!feof($sock))
{
$data .= fgets($sock, 1024);
}
fclose($sock);
//players online and max (ex. Players online: 24 / 100)
preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
//print 'Estado:<b><font face="verdana" size="2" color="#00FF00"> Online</font></b>';
$players = 'Online: '.$matches[1].' / '.$matches[2];
//Owner Name and e-mail (ex. Owner Name: jasper E-mail: jaja@jaja.com)
preg_match('/owner name="(\D*)" email="([\w\._]+@[\w\._]*)"/', $data, $matches);
$owner = 'sd: '.$matches[1];
//Uptime (Uptime: 23h 12m)
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$uptime = 'Uptime: '.$h.'h '.$m.'m';
//uncomment for debug
//print "$owner <br /> $uptime <br /> $players";
$image = imagecreatefrompng('fondo.png');
header("Content-type: image/png");
$black = imagecolorallocate($image, 0, 0, 0);
Imagestring($image,2,(imagesy+5),(imagesy+23),$uptime,$black);
Imagestring($image,2,(imagesy+5),(imagesy+37),$players,$black);
imagepng($image);
imagedestroy($image);
}else {
$offline = "Servidor offilne";
$image = imagecreatefrompng('fondo.png');
header("Content-type: image/png");
$black = imagecolorallocate($image, 0, 0, 0);
Imagestring($image,2,(imagesy+5),(imagesy+23),$offline,$black);
imagepng($image);
imagedestroy($image);
}
?>
Warning: fsockopen() [function.fsockopen]: unable to connect to 83.149.85.11:7171 (Connection timed out) in /home/utibia/public_html/uptime.php on line 4
Help please