php bot to find number of indexed pages in search engines

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

php bot to find number of indexed pages in search engines

Post by someguyhere »

I'm trying to write a bot to query the search engines to see how many pages they have indexed for a particular URL. Can someone tell me why the following code doesn't produce any results?

Code: Select all

<?php
 
$return=file_get_contents("http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=KZD&q=site%3Amsn.com&btnG=Search&meta=");
 
//Results 1 - 10 of about 36,800,000 from google.com. (0.15 seconds) preg_match("/of about (.*?) from/",$return,$output); $output=$output[1];
 
echo'Pages indexed for google.com '.$output;
 
?>
You can see the bot in action here: http://www.wildfiremarketinggroup.com/A ... ndexed.php
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: php bot to find number of indexed pages in search engines

Post by jayshields »

Try doing print_r($output) and see what happens.
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: php bot to find number of indexed pages in search engines

Post by someguyhere »

Nothing comes up
<?php

$return=file_get_contents("http://www.google.com/search?hl=en&clie ... arch&meta=");

//Results 1 - 10 of about 36,800,000 from google.com. (0.15 seconds) preg_match("/of about (.*?) from/",$return,$output); $output=$output[1];

echo'Pages indexed for google.com '.$output;

print_r($output);

?>
Post Reply