Update: When I pasted this script I had some problems with the slashes that got lost on the way. I did not notice it and most who use it fixed them but I changed the script now to a functional version.
This has to be regarded as an educational script and should not be used outside Google.com guidelines! Check here for The MSN Version and this is the link to a Google results counter script.
Warning : This article uses and relies on the PHP Script cUrl Class which is mandatory for the following script to work!
You should not need to do this. This script is educational and not for unethical use!
But … hypothetically speaking … this could be used for several reasons. To find your ranking in the SERPs, to see how many pages you have indexed, to see competition and watch certain keyphrases for new sites or sites that drop and so on …
If you can't help it and you will use this use common sense and do not hammer Google. You will get a temporary ban and it's not so great. Keep at least 30-60 seconds between queries and do not do more then 25 in a row. Simulate human behaviour or be kicked. Even if you help Google save bandwidth by not viewing the search page dependencies you loose him money for not clicking the ads!
There is a trick, don't know how long it will last that allows you to use a * at the end of the search to find non-supplemental pages.
So site:yoursite.com/ will show all pages indexed, and site:yoursite.com/* will list those in main index (non-supplemental). Do the math and get the list of supplemental pages by differencing the two arrays. PHP coders are always lucky on this site:
<?
// Easy way to spot your supplemental pages
$AllLinks = googleLinks("site:yoursite.com/",1,100);
$MainIndex = googleLinks("site:yoursite.com/*",1,100);
$Supplementals = array_diff($AllLinks,$MainIndex);
?>
Virtual legends say that site:yoursite.com/& brings supplementals directly but the numbers do not add up so I do not consider this query functional.
Enough with the chit-chat! Let's get on to the code …
$page parameter is the page number and starts from 1. Never use 0-9 pages but 1-10!The googleLinks is a helper function and will only list the URLs of the results.
It is the first element of an array of 10 output by:
<? print_r(googleResults("site:tellinya.com/",1,10)); ?>
Array
(
[0] => Array
(
[Rank] => 1
[Url] => http://www.tellinya.com/
[Title] => (I'm)TellinYa - Bits of wisdom published by regular people
[Host] => www.tellinya.com
[Protocol] => http
[Path] => /
[Summary] => (I'm)TellinYa - Bits of wisdom published by regular people.
)
)
n-Joy and stay safe! I take no responsabilities, ... bla bla bla.
$links=googleLinks("your search goes here",1,10);
$links=array_slice($links,0,5);And you got the 5 links.
Post Feedback