Shoutbox

is the server online using php - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: is the server online using php (/showthread.php?tid=84144)

is the server online using php by Jarrod on 06-05-2008 at 08:53 AM

well i have a shoutcast server running on my pc it's all working with port fowarding and stuff  but i want to use some php to test if the port is open or closed(running or shutdown)
using https://www.grc.com i have seen that their script does just what i want but i'm looking for some php to do something similar,
i found this

code:
<?
$ip = "http://247.212.233.220"; // IP Here
$port = 8000; // Port Here
if(fsockopen($ip, $port, $errno, $errstr, '10'))
echo "The  server is <font color='green'>Online</font>!";
else
echo "The  server is <font color='red'>Offline</font>!";
?>

but even if the port is open and https://www.grc.com says it's open the php script says it closed can some one help?
RE: is the server online using php by Menthix on 06-05-2008 at 09:06 AM

What does $errstr say?


RE: is the server online using php by Jarrod on 06-05-2008 at 09:26 AM

i don't know how it works here is the link though and i'll put the server up until 9:00pm AEST
http://home.exetel.com.au/goldenleads/is_server_running.php


RE: is the server online using php by Menthix on 06-05-2008 at 09:31 AM

Try this:

code:
<?
$ip = "http://247.212.233.220"; // IP Here
$port = 8000; // Port Here
if(fsockopen($ip, $port, $errno, $errstr, '10')) {
   echo "The  server is <font color='green'>Online</font>!";
} else {
   echo "The  server is <font color='red'>Offline</font>!<br/>";
   echo "Returned error: ".$errstr." (code ".$errno.")";
}
?>

RE: is the server online using php by Jarrod on 06-05-2008 at 09:48 AM

it doesn't seem to work,:(
one thing i may need to state is that my shoutcast server isn't hosting my php that's hosted somewhere else,
i think you gathered that MenthiX but just to be sure, well
how it when both times it returned the server was offline
with the http:// in front of the ip address it returned permission denied on the next line, with the http:// removed it returned Invalid argument


RE: is the server online using php by Eljay on 06-05-2008 at 09:50 AM

Well for a start the IP shouldn't contain the "http://" bit at the start :P

Also, timeout shouldn't be in quotes, it's not a string.


RE: is the server online using php by Jarrod on 06-05-2008 at 10:15 AM

didn't fix anything


RE: is the server online using php by Felu on 06-05-2008 at 10:28 AM

Try this http://www.phptoys.com/e107_plugins/content/content.php?content.41 ?


RE: is the server online using php by NanaFreak on 06-05-2008 at 10:35 AM

quote:
Originally posted by Jarrod
didn't fix anything
are you sure you have:
code:
<?
$ip = "247.212.233.220"; // IP Here
$port = 8000; // Port Here
if(fsockopen($ip, $port, $errno, $errstr, 10)) {
   echo "The  server is <font color='green'>Online</font>!";
} else {
   echo "The  server is <font color='red'>Offline</font>!<br/>";
   echo "Returned error: ".$errstr." (code ".$errno.")";
}
?>
because i just tested it on my localhost and it says that its online =\
RE: is the server online using php by Jarrod on 06-05-2008 at 11:50 AM

NF
The server is Offline!
Returned error: Invalid argument (code 22)

i'm looking at felu's now but me being less knowledgeable than every1 elses it might take a while


RE: is the server online using php by ipab on 06-05-2008 at 04:29 PM

I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.


RE: is the server online using php by RaceProUK on 06-05-2008 at 06:03 PM

quote:
Originally posted by ipab
I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.
If that was true, grc.com would show the port stealthed.
RE: RE: is the server online using php by segosa on 06-05-2008 at 10:34 PM

quote:
Originally posted by RaceProUK
quote:
Originally posted by ipab
I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.
If that was true, grc.com would show the port stealthed.

More to the point, if that were the case you wouldn't be able to use the internet at all. All that script does is initiate a connection to the IP address, exactly how your browser would if you tried to visit a website.
RE: is the server online using php by Jarrod on 06-05-2008 at 11:11 PM

quote:
Originally posted by RaceProUK
quote:
Originally posted by ipab
I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.
If that was true, grc.com would show the port stealthed.
i have ssh set up and https set up for remotely anywhere my isp does not block ports they are just to cool, other people can listen to the shoutcast stream and everything it's just the php script doesn't reflect the fact the port is open but atm it will be closed cos the server is not running
is there a service like grc.com i could use and just return values from their page and show them in mine?
RE: is the server online using php by RaceProUK on 06-06-2008 at 06:32 PM

quote:
Originally posted by segosa
quote:
Originally posted by RaceProUK
quote:
Originally posted by ipab
I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.
If that was true, grc.com would show the port stealthed.
More to the point, if that were the case you wouldn't be able to use the internet at all. All that script does is initiate a connection to the IP address, exactly how your browser would if you tried to visit a website.
Not really: the stealthing is done on incoming traffic. Outgoing traffic is unfiltered, and replies to that are allowed through, as the local port is often well into the client port range. I usually see port numbers of 3000 or more.
RE: RE: is the server online using php by segosa on 06-07-2008 at 02:53 PM

quote:
Originally posted by RaceProUK
quote:
Originally posted by segosa
quote:
Originally posted by RaceProUK
quote:
Originally posted by ipab
I think the simpler answer here is that your ISP is blocking all external requests for open ports :S... I know my ISP does that.
If that was true, grc.com would show the port stealthed.
More to the point, if that were the case you wouldn't be able to use the internet at all. All that script does is initiate a connection to the IP address, exactly how your browser would if you tried to visit a website.
Not really: the stealthing is done on incoming traffic. Outgoing traffic is unfiltered, and replies to that are allowed through, as the local port is often well into the client port range. I usually see port numbers of 3000 or more.

I think there was a bit of a misunderstanding. I thought the PHP script was running on his local PC and the shoutcast server elsewhere, not the other way around.

Anyway, if the shoutcast server is running on his computer, and he has the port forwarding set up and people are able to connect then there's no reason why the PHP script (which is running on his webhosting or something similar, right?) shouldn't be able to. It can be thought of as just another client.


RE: is the server online using php by Jarrod on 06-07-2008 at 10:23 PM

that's why I thought there must be a problem with the script:p hope that means something to the people who know more about php than me, thanx