I am using a the following code to see if a website is down or not.
<?php
if (isset($_POST['submit'])) {
$url = $_POST['url'];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($code == 200) {
echo "<h3>Up!</h3>";
} else {
echo "<h3>Down!</h3>";
}
}
?>
<form action="" method="post">
Url: <input type="text" name="url" /><br />
<input type="submit" name="submit" />
</form>
The issue I am having is when I check facebook.com it says its down but it isn't...
Why is this doing this? I orginally thought it could be the https but google works fine.