views:

36

answers:

1

hey,

I'm trying to get google results html for the search term

intitle:index.of ”last modified” ”parent directory” (mp3|wma|ogg) "test" -htm -html -php -asp

using file_get_contents

so something like this :

$file = file_get_html("http://www.google.com/search?q=intitle:index.of%20%20%94last%20modified%94%20%20%94parent%20directory%94%20%20%28mp3|wma|ogg%29%20%20%22test%22%20-htm%20-html%20-php%20-asp");

(basically this is the search term :

http://www.google.com/search?q=intitle:index.of ”last modified” ”parent directory” (mp3|wma|ogg) "test" -htm -html -php -asp

)

and its doing a 503

anyone know how I can get this working?

Thanks

+3  A: 

Scraping is against Google's TOS (read 5.3). You should use their API:

http://code.google.com/apis/ajaxsearch/documentation/

There are examples on how to use it in PHP. Using the API also returns a structured object (JSON) so you'll save resources with CPU power (parsing) and bandwidth (JSON contains data only).

Aillyn