Terrum Posted July 9, 2008 Share Posted July 9, 2008 This error comes up when i access my page. (Note: I wrote HIDDEN to hide information i don't want on this forum.) Warning: fsockopen() [function.fsockopen]: unable to connect to HIDDEN (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in D:\xampp\htdocs\bod\radio_stats.php on line 22 your message is Offline It says this because it can't connect to the server (Because it isn't up). Now the question is, How do I make it so that it doesn't show up that error? It just continues the script ignoring that error or something? It's trying to connect to a SHOUTcast server I host, but its not up unless i turn it on, and instead of it coming up with that error, i just want it to say offline (It says offline when the shoutcast server is on, but no one is hosting on it) So im guessing the script must continue and ignore that error or something so it says Offline. Basic question: If there is a way to remove that error, then that's basically what I want. I hope you understand Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted July 9, 2008 Share Posted July 9, 2008 You can use a try catch block to contain the error. An exemption will allow you to report back that the server is down. Quote Link to comment Share on other sites More sharing options...
discomatt Posted July 9, 2008 Share Posted July 9, 2008 Add '@' in front of the function call to suppress errors @fsockopen( params ) Quote Link to comment Share on other sites More sharing options...
Terrum Posted July 10, 2008 Author Share Posted July 10, 2008 Add '@' in front of the function call to suppress errors @fsockopen( params ) Thanks. After adding the @ and a bit more editing, It works how i like it. Thanks alot! Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted July 10, 2008 Share Posted July 10, 2008 Using @ for error correction is poor practice. It will suppress the error but in the long run it's better to deal with the error and fail gracefully. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted July 10, 2008 Share Posted July 10, 2008 He's handling the error, but it'll still echo the error message without the @. What he's doing is perfectly fine, as long as I understand his post. o-O Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.