Jump to content


Anyone know


3 replies to this topic

#1 Gimp

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 25 May 2006 - 03:47 PM

As I'm a newbie to php/mysql I was wondering if you have come across any tutorials about website monitoring, I own a few websites and would like to run a script on one site to monitor my others. I would be very greatful if you could help me.
Thank you
Gimp

Edited by Gimp, 25 May 2006 - 05:39 PM.


#2 AvengeX

    Young Padawan

  • Members
  • Pip
  • 50 posts
  • Gender:Male
  • Location:Kingston upon Thames, UK
  • Interests:d&b

Posted 27 May 2006 - 03:15 AM

Well to check if a site is up, you can use this:
<?php
$site = "http://www.yoursite.com";
if(fsockopen($site,80)===TRUE) {
echo $site." is up!";
}
else {
echo "$site is down :(";
}
?>

That's got you on your way!

#3 Matthew.

    Official Spammer .Matt

  • Members
  • PipPipPipPip
  • 2,749 posts
  • Gender:Male
  • Location:England

Posted 27 May 2006 - 04:29 AM

Shorter:

<?php
$site = "http://www.yoursite.com";

echo (fsockopen($site,80)===TRUE) ? "$site is up!" : "$site is down!";
?>

No need for that lengthy if statement :)

If your just looking for a short section as to if your site is up/down then always go for the shortest code possible :)

#4 Gimp

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 27 May 2006 - 10:23 AM

Oh cool, thanks for your help. :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users