Jump to content

[SOLVED] Ping Multiple sites with script


ibda12u

Recommended Posts

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();
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/78005-solved-ping-multiple-sites-with-script/
Share on other sites

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...

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!

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.