0

I have a couple of sites (on different servers) that I want to see if some critical urls are up and running and this is what I've tried:

$handle = curl_init($url);
curl_setopt($handle,  CURLOPT_RETURNTRANSFER, TRUE);

/* Get the HTML or whatever is linked in $url. */
$response = curl_exec($handle);

/* Check for 404 (file not found). */
$httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);
if($httpCode == 404) {
    /* Handle 404 here. */
}

curl_close($handle);

This however always returns a redirect to the login page.

How do change the code so that it logs in first and then checks the url?

Cheers
/Adam

2
Contributors
2
Replies
15
Views
1 Year
Discussion Span
Last Post by adishardis
0

If you just want to know if the site is up then doesn't the redirect tell you that the site is up?

0

Well no, these particular pages might be down even though the site is up and running...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.