Hente links fra Google

Tags:    php

Hvordan henter jeg alle de links google finder?

Den skal crawle alle disse den finder ved denne:
Fold kodeboks ind/udKode 


Og outputter de links den finder?





1 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
Sorter efter stemmer Sorter efter dato
<?php
$found = array();
for ( $i=0;$i<500;$i++) {
$s = urlencode('inurl:"submit.php" intitle:"Submit link"');
$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=".$i."&q=".$s;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.goo".mt_rand(0,2999).".dk");
$body = curl_exec($ch);
curl_close($ch);
$json = json_decode($body);

foreach ( $json->responseData->results as $fisse ) {
if ( !in_array($fisse->url, $found)):
$found[] = $fisse->url;
endif;
}
}

foreach ( $found as $results ) :
echo $results . "<br />";
endforeach;





t