0
我尝试ping谷歌,当我更新地图,但总能得到响应“0”谷歌平失败 - 卷曲
这里就是我想:
$sitemapUrl = urlencode("http://testsite.com/Sitemap.xml");
// cUrl handler to ping the Sitemap submission URLs for Search Engines…
function myCurl($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpCode;
}
//Google
$url = "http: //www.google.com/webmasters/tools/ping?sitemap=".$sitemapUrl;
$returnCode = myCurl($url);
echo = "<p> Google Sitemaps has been pinged (return code: $returnCode). </p>";
将返回:
Google Sitemaps has been pinged (return code: 0).
您是否注意到协议后URL中的空格? – morgoth84
@ morgoth84 Aaaargh我是个白痴!谢谢。 –