Page 1 of 1

fsockopen ??

Posted: Tue Aug 03, 2004 9:37 pm
by CSL126
Hey guys, I was wondering if anyone could write me a short script. I just want to simply check to see if a server is running. I was told to use fsockopen() on a different forum, but I could never figure out how to get it to work. It works when the server is online, but when it is offline, it throws me a bunch of errors and warnings. How can I get rid of those, and just simply display "server is offline" ?? Thanks in advance!

Posted: Tue Aug 03, 2004 9:42 pm
by nigma
Add a @ to the beginning of the function call:

Code: Select all

@fsockopen("domain");

Posted: Tue Aug 03, 2004 9:44 pm
by CSL126
Ok, cool i'll try that out... Thanks a lot!

Posted: Tue Aug 03, 2004 9:58 pm
by nigma
Let me know how things turn out.

Posted: Tue Aug 03, 2004 11:36 pm
by CSL126
Works great! what exactly does the "@" symbol do when it's in front of fsockopen() though?

Posted: Tue Aug 03, 2004 11:45 pm
by feyd
it suppresses any error that may get output.. say the domain doesn't respond or something..

Posted: Tue Aug 03, 2004 11:47 pm
by nigma
You know, I asked the same question a few months ago, I knew it somehow suppressed errors, but I wasn't sure if it was supposed to do that or if it was just a hack.

Let me do some searching and try to find my post.