Hello friends ajj me apko btaunga ki kis parkar ham check kar sakte hai ki website is available or not.
Demo-check website is Available or Not
<form action="" method="post">
Enter Website Url<input type="text" name="name"><br>
<input type="submit" name="submit"/>
</form>
<?php
error_reporting(0);
function Siteexist($url){
// Initialize cURL
$curlInit = curl_init($url);
// Set options
curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlInit,CURLOPT_HEADER,true);
curl_setopt($curlInit,CURLOPT_NOBODY,true);
curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
// Get response
$response = curl_exec($curlInit);
// Close a cURL session
curl_close($curlInit);
return $response?true:false;
}
$URL = $_POST['name'];
if(Siteexist($URL)){
echo 'The website is available.';
}else{
echo ' site is not found.';
}
?>
Thank You
Team Gajabwap Web In Hindi
ConversionConversion EmoticonEmoticon