Created
January 12, 2020 00:08
-
-
Save eurowebpage/a835170438c9102868ccbcbf7514768b to your computer and use it in GitHub Desktop.
Vérifier une url indexée sur Google script php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function indexed($url) { | |
$url = 'http://webcache.googleusercontent.com/search?q=cache:' . urlencode($url); | |
$ch = curl_init($url); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); | |
curl_setopt($ch, CURLOPT_NOBODY, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, 'Chrome 10'); | |
if (!curl_exec($ch)) { | |
// var_dump('failed'); | |
return false; | |
} | |
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); | |
//var_dump($code); | |
return $code == '200'; | |
} | |
echo indexed('https://votre-site.eu/'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment