Hi, Whats the best solution for writing a php script to detect is a page was indexed by google (not the number of indexed pages - for this I have a solution) also is there any suggestions for last crawl of a page php script? Thanks
Google API might allow you to do query to check if a url is indexed. Look into webmaster tool. However, google might have limit on how many queries you can run per a period of time. Or you can just simple type in "info:your_url" in the search box to check as described at "Check if a web page is indexed by google" Programmatically, you can write a simple file_get_contents() with the "info:" query to check if a web page is indexed by google by checking the result text being returned by google.
Thanks littlejohn199, Is there any limits from google on opening a file using file_get_contents() with the "info:" like number of quires etc? also do you now of a way to find out the last crawl date of a page?
webmaster tools works generally well to find out number of pages crawled per day. If you just want to see if one page is indexed you can always use the google search term: site: www . yoursite . com to check
@ruvenf I think google might have mechanism to detect excessive hits from a website/script to their website. Honestly, I don't really know exactly, but you can write a simple script to hit google website. Make sure you don't run this script on your real website, run it in your test environment. <?php for($i=0;$i<1000;$i++) { $content = file_get_contents("http://www.google.com"); echo $content; //the actual url to get "info" for a url looks like this http://www.google.com/#sclient=psy&...=1&bav=on.2,or.r_gc.r_pw.&fp=822bf32b5c0e0691 } ?> If google doesn't block your script, then there is good chance you can query google site directly without using their API. Hope this helps Little John