Tag Archives: seo

Script to check the last date when Bing.com bot is indexing your site

On previous post, I create PHP script to check how many pages from your site is indexed in Bing.com search engine as part of fixing my old SEO statistic checker library. Now, we will check recent date where Bing.com search engine bot indexing your site. We will use scraping technique again, so, we can save our Azure Datamarket quota. How’s this useful for you? Well, it measured how much love Bing.com gave to your site.. 😛

bing.com bot query

Without more talk, here’s the full PHP source code:

//helper function again
//file_get_contents using curl
function file_get_contents_curl($url, $referer="", $ua="Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Ubuntu/10.04 Chromium/7.0.514.0 Chrome/7.0.514.0 Safari/534.7")
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Set curl to return the data instead of printing it to the browser.
    if ($referer!="") {
        curl_setopt($ch, CURLOPT_REFERER, $referer);
    } else {
        curl_setopt($ch, CURLOPT_REFERER, $url);
    //curl_setopt($ch, CURLOPT_URL, $url);
    if ($ua!="") {
		curl_setopt($ch, CURLOPT_USERAGENT, $ua);
	} else {

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_close ($ch);

    return $data;

function bingbot($url)
    $url1                 ="http://www.bing.com/search?q=url%3A" . urlencode($url) . "&go=&qs=n&form=QBRE&mkt=en-WW";
    $data1                =file_get_contents_curl($url1);
    if (strpos($data1, '
", $data2); $xpl4 =explode("", $xpl3[1]); // var_dump($cacheurl, $xpl4); list($mo, $day, $year)=explode('/', $xpl4[0]); return $year . "-" . $mo . "-" . $day; } else { return 'N/A'; } }

Same as before, no fancy coding here. You can improve the data processing by using regular expression. You may ask, why we need to create our own file_get_contents as helper function, PHP already had one? You got it, we can use built-in file_get_contents function if we want. The reason why I create our own file_get_contents is to fool Search Engine that our query is legit and look natural (you know, we are doing illegal thing here –scraping search engine result– 👿 ). The other thing is that cURL has so many options that easily been set to our purpose (sure you can create stream context for built-in file_get_contents but is not that easy to understand to create it) .

How to use it:

echo bingbot('www.mp32u.net');

Example result:


Fully working demo can be tested on: http://www.vrank.org/ on “Bing.com Bot” section.
As you can see, Bing.com bot is not really accurate. It only mention the date, Googlebot has more detailed info such as the time. Remember that the result might be different depending on your server location (where you run the script).