PHP not working with Port Array?

hey, i have been working on a site for a while and i came across something that stumped me, and for the life of my i can not work out why it is not working, so i have made a site that pings game servers and comes back telling you whether they are online or offline and a ping to the server, now all this works correctly, all the information such as IP server name etc is pulled from the MySQL database, but when i try do the same thing for the Port number its a no go, i will put some of my code below to see if any of you guys can see what is wrong.

[php]

<?php $con = mysql_connect('localhost', 'root', 'Gemma9428'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("arr", $con); $time=time(); //server connect $timedb = mysql_query("SELECT time FROM status WHERE ServerID=1"); $query="SELECT * FROM status"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ServerName[]=mysql_result($result,$i,"ServerName"); $Language[]=mysql_result($result,$i,"Language"); $Ping[]=mysql_result($result,$i,"Ping"); $Ip[]=mysql_result($result,$i,"Ip"); $Port[]=mysql_result($result,$i,"Port"); $Boot[]=mysql_result($result,$i,"boot"); $Client[]=mysql_result($result,$i,"Client"); $i++; } while($timedb2 = mysql_fetch_array($timedb)) { if ($time >= ($timedb2['time'] +90)) { mysql_query("UPDATE status SET time=$time WHERE ServerID=1"); //patch // function pingDomain($domain){ $starttime = microtime(true); $file = fsockopen ($domain,443, $errno, $errstr, 2); $stoptime = microtime(true); $status1 = 0; if (!$file) $status1 = -1; // Site is down else { fclose($file); $status1 = ($stoptime - $starttime) * 1000; $status1 = floor($status1); } return $status1; } $domainbase = $Ip[0]; $status1 = pingDomain($domainbase); if ($status1 != -1) { echo "Online"; echo "$ServerName[0]"." " ."Server"; echo "$Language[0]"; echo"$status1 ms"; // update code mysql_query("UPDATE status SET PING=$status1 WHERE ServerID=1"); } else { echo "Offline"; echo "$ServerName[0]"." " ."Server"; echo "$Language[0]"; echo "0 ms"; mysql_query("UPDATE status SET PING=$status1 WHERE ServerID=1");} echo ""; [/php] now this line here is the problem [php] $file = fsockopen ($domain,443, $errno, $errstr, 2);[/php] the port number is 443, but i cannot replace that with say $Port[0] or [1], it just tells me the server is offline when it is not. as you can see all of these work apart from the port one [php] $ServerName[]=mysql_result($result,$i,"ServerName"); $Language[]=mysql_result($result,$i,"Language"); $Ping[]=mysql_result($result,$i,"Ping"); $Ip[]=mysql_result($result,$i,"Ip"); $Port[]=mysql_result($result,$i,"Port"); $Boot[]=mysql_result($result,$i,"boot"); $Client[]=mysql_result($result,$i,"Client");[/php] i can even just echo the $Port[0] and it will echo 443 but when put into the above code it is a no go, anyone got any Idea's?
Sponsor our Newsletter | Privacy Policy | Terms of Service