/    Sign up×
Community /Pin to ProfileBookmark

PHP script to check site is up

Is there a PHP script that can check a web address and email me if the site goes down? I’ll obviously have it on a cron job.

I’m also looking for it to check the content of the site too. For example if the site responds and pings but the files aren’t served.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@stephan_gerlachApr 16.2008 — well in that case there is a really easy way


[code=php]

// your url to check
$url = 'http://www.domain.com';

// Word(s) you check for
$word = 'Welcome to your site';

$content = file_get_contents($url);

if (!strstr($content,$word)) {

mail('YOUREMAIL','SITEDOWN','MESSAGE');

}

[/code]
×

Success!

Help @sanchez_1960 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...