NLT Posted May 12, 2012 Share Posted May 12, 2012 What would be the best way to return: One image (let's say, green.png) if the specified website is up Second image (let's say, red.png) if the specified website is down Third image (let's say, orange.png) if the website is slow. Would the best option be to use file_get_contents? Or a exec Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/ Share on other sites More sharing options...
3cool4school Posted May 12, 2012 Share Posted May 12, 2012 by return are you sending the value somewhere, or just trying to display it? Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344962 Share on other sites More sharing options...
NLT Posted May 12, 2012 Author Share Posted May 12, 2012 Just displaying it. Well, show an image relevant to whether the server is up, down, or slow. Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344967 Share on other sites More sharing options...
NLT Posted May 12, 2012 Author Share Posted May 12, 2012 Actually, I've got another idea. Have one image, but with 3 different light images obviously, and change the image (imagename.jpg) to whatever is relevant, but keeping the imagename.jpg file name the same. If that's possible, that is. Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344968 Share on other sites More sharing options...
3cool4school Posted May 12, 2012 Share Posted May 12, 2012 Throw in the correct image location lbut you have to have your conditions so something along these lines <?php $theimage = ""; if (SERVER UP CONDITION){ $theimage .= "<img src ='green.png' />"; } elseif (SERVER DOWN CONDITION){ $theimage .= "<img src ='red.png' />"; } elseif (SERVER SLOW CONDITION){ $theimage .= "<img src ='orange.png' />"; } ?> then wherever you want to display is (I would use a div so you can control sizing and location etc) <div class ="serverstatus"> <?php echo $theimage; ?> </div> I'm not sure if you needed help with the actual figuring out if the server was down up or slow Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344979 Share on other sites More sharing options...
NLT Posted May 12, 2012 Author Share Posted May 12, 2012 Would there be a way to have it all in one image? Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344983 Share on other sites More sharing options...
xyph Posted May 12, 2012 Share Posted May 12, 2012 There's a way to have it in a single image, but you'd then need to use CSS to 'change' the image http://yensdesign.com/tutorials/masteringbackgroundposition/ Quote Link to comment https://forums.phpfreaks.com/topic/262442-server-is-up-or-not/#findComment-1344986 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.