ibda12u Posted November 20, 2007 Share Posted November 20, 2007 Hello I'm trying to ping several websites in order to keep them alive. I have a simple script here that I use that works great for 1 website. but if I include another site, my script doesn't run. Is there a way I can run this script and have it open more than 1 site at a time? <?php ob_start(); include("http://mywebsite.com"); ob_end_clean(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/ Share on other sites More sharing options...
btherl Posted November 20, 2007 Share Posted November 20, 2007 Can you show us the script that doesn't work? In any case, it's better that you use CURL to do your requests if you simply want to ping. Curl lets you set a timeout as well. Quote Link to comment https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/#findComment-394829 Share on other sites More sharing options...
pkSML Posted November 20, 2007 Share Posted November 20, 2007 If you just need to hit some sites in order to keep it from inactivity, just do this: <?php $a = file_get_contents("http://yoursite1.com"); echo "Site#1 is " . strlen($a) . " bytes long.<BR><BR>"; $b = file_get_contents("http://yoursite2.com"); echo "Site#2 is " . strlen($b) . " bytes long.<BR><BR>"; ?> You get the point on how to do this for multiple websites... Quote Link to comment https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/#findComment-394866 Share on other sites More sharing options...
ibda12u Posted November 20, 2007 Author Share Posted November 20, 2007 If you just need to hit some sites in order to keep it from inactivity, just do this: <?php $a = file_get_contents("http://yoursite1.com"); echo "Site#1 is " . strlen($a) . " bytes long.<BR><BR>"; $b = file_get_contents("http://yoursite2.com"); echo "Site#2 is " . strlen($b) . " bytes long.<BR><BR>"; ?> You get the point on how to do this for multiple websites... That worked perfectly! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/#findComment-395135 Share on other sites More sharing options...
pkSML Posted November 20, 2007 Share Posted November 20, 2007 Quote Link to comment https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/#findComment-395285 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.