Jump to content

[SOLVED] Making error clause


AV1611

Recommended Posts

I have a script that does this:

 

$site="http://".$url."/".$url."/pbsvss.htm";
$lines = file($site);

 

If the IP is valid, the punkbuster screenshot list for that server is output, and I can parse out the document to check for hackers, etc...

 

If the wrong IP is given (Or the server is misconfigured) you get this:

 

Warning: file(http://1.2.2.2/1.2.2.2/pbsvss.htm) [function.file]: failed to open stream: Connection timed out in /home/osprey/public_html/aao/whoisonaserver.php on line 14

Warning: Invalid argument supplied for foreach() in /home/osprey/public_html/aao/whoisonaserver.php on line 17

 

What I need is instead of that message, is a simple clause that I can put my own error message i.e. "The server is not responding, Check the IP or contact the server Admin"

 

IF (worked) {parse}

else {error message}

Link to comment
https://forums.phpfreaks.com/topic/41645-solved-making-error-clause/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.