i am creating an script for seo check where script need to check website have sitemap or not...
how can i check some website have sitemap or not with php or javascript..
i have tried with check robot.txt but some time if some website not index sitemap robot.txt.
my question is finished but its still saying describe your problem etc.. what should i write? i dont knwo so i am just putting dammy text on text box hoop its owrkkng my question is finished but its still saying describe your problem etc.. what should i write? i dont knwo so i am just putting dammy text on text box hoop its owrkkng my question is finished but its still saying describe your problem etc.. what should i write? i dont knwo so i am just putting dammy text on text box hoop its owrkkng
the following script is a simple php Curl that checks if a file exists.
$checkForFiles = array('robots.txt','sitemap.xml');
$host = 'http://php.net/';
foreach($checkForFiles as $file){
$url = $host . $file;
$ch = curl_init ($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$output = curl_exec ($ch);
if(curl_getinfo($ch)['http_code'] != 200){
echo $file . ' does not exist on ' . $host . '<br>';
}else{
echo $file . ' does exist on <a target="_blank" href="'.$host . $file.'">' . $host . $file .'</a>' . '<br>';
}
curl_close($ch);
}