<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Botunun Son Ziyareti</title>
<meta http-equiv="Content-Type" content="text/HTML; charset=utf-8" />
<link href="/sonindeks/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="iso">
<?php
$adres = $_POST["adres"];
//get googlebot last access
function googlebot_lastaccess($adres)
{
$request = 'http://webcache.googleusercontent.com/search?hl=en&q=cache:'.$adres.'&btnG=Google+Search&meta=';
$data = getPageData($request);
$data = getPageData($request);
$spl=explode("appeared on",$data);
//echo "<pre>".$spl[0]."</pre>";
$spl2=explode("GMT",$spl[1]);
$value=trim($spl2[0]);
//echo "<pre>".$spl2[0]."</pre>";
if(strlen($value)==0)
{
return(0);
}
else
{
return($value);
}
}
echo "Google Botunun Son Ziyareti </br></br> ".googlebot_lastaccess($adres)."<br />";
function getPageData($url) {
if(function_exists('curl_init')) {
$ch = curl_init($url); // initialize curl with given url
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // add useragent
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // write the response to a variable
if((ini_get('open_basedir') == '') && (ini_get('safe_mode') == 'Off')) {
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // follow redirects if any
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); // max. seconds to execute
curl_setopt($ch, CURLOPT_FAILONERROR, 1); // stop when it encounters an error
return @curl_exec($ch);
}
else {
return @file_get_contents($url);
}
}
?></div>
</body>
</html>Not : Bir de aynı işlevi farklı bir yoldan yapmıştım bu da localhostta sorunsuz fakat hosta atınca çekemiyor veri. : http://notes.io/quLQ