ATTN: PHP Gurus 5 replies

Please wait...

Sovetskeey

The Canadian on the forums...

50 XP

8th December 2003

0 Uploads

640 Posts

0 Threads

#1 15 years ago

Okay, I heard it could be done... I want to ping my computer on port 8000 to check if my Shoutcast server is running and report it in a line of text like "My server is currently offline.".




Sheepeep Advanced Member

weirdal = new ptaq()

31,600 XP

2nd September 2003

0 Uploads

2,948 Posts

0 Threads

#2 15 years ago

[php] <?php $theserver = "yourserver"; $port = "8000"; if(@fsockopen($theserver, $port)) { echo "Online!"; } else { echo "Offline!"; } ?> [/php] First way that came into my head, thats what I use to check that my webserver is running, the chances are that this will work for a Shoutcast server too, in fact it'd probably work for a game server or pretty much anything that responds on a port. fsockopen basically checks if theres a response on that domain/IP and port, the @ supresses an error message cause its messy when its offline I find, whether this is the best way to do it I have no idea, but it works. And after writing that and being too lazy to edit it, I checked by starting my shoutcast server, it works. I don't think it'll distinguish between whether its playing music or not though, but it'll almost certainly tell you if its on. Oh...And yeah, obviously you'll need to enter the values at the top, scripts aren't psychic, I am.




Sovetskeey

The Canadian on the forums...

50 XP

8th December 2003

0 Uploads

640 Posts

0 Threads

#3 15 years ago

Awesome, thanks Sheepeep! I probably should have asked how to use it :P . BTW, what happened to that awesome signature with the Lion from the Lions in Kenya movie?




Sheepeep Advanced Member

weirdal = new ptaq()

31,600 XP

2nd September 2003

0 Uploads

2,948 Posts

0 Threads

#4 15 years ago
BTW, what happened to that awesome signature with the Lion from the Lions in Kenya movie?

It was above the limit when it changed, I never resized it again, maybe I will someday, it still exists here I think, I dunno anymore :p [edit]Yes, it does exist, I might resize it and use it again sometime this/next week.[/edit]

Awesome, thanks Sheepeep!

Heh, thank Shimano55 for showing me this so that I could help, and php.net for creating PHP in the first place, I just sit there and push buttons until they work :p




Sovetskeey

The Canadian on the forums...

50 XP

8th December 2003

0 Uploads

640 Posts

0 Threads

#5 15 years ago

Would it be possible to have it time out after like five seconds?




shimano55

AoE3 Files Vice *****

50 XP

23rd November 2003

0 Uploads

1,462 Posts

0 Threads

#6 15 years ago

heh...dont thank me...lol

I just told him where it was... :)

I dunno very much about shoutcast...so i said.. "Hey, sheep! Go help this guy on GF!" and the rest is history! ;)

good luck man..