Dobby89
11-14-2009, 02:29 PM
I've been trying to use the simple html dom class to scrape search results from google. The code I'm using at the moment is below.
Now, the code works if I change the source website simply to http://www.google.com, but it doesn't seem to like the search suffix "search?q=example".
Is there something I'm missing?
<?php
include ('simplehtmldom/simple_html_dom.php');
// create HTML DOM
$html = file_get_html('http://www.google.com/search?q=example');
// find all links
foreach($html->find('a') as $e)
echo $e->href . "<br>";
?>
Now, the code works if I change the source website simply to http://www.google.com, but it doesn't seem to like the search suffix "search?q=example".
Is there something I'm missing?
<?php
include ('simplehtmldom/simple_html_dom.php');
// create HTML DOM
$html = file_get_html('http://www.google.com/search?q=example');
// find all links
foreach($html->find('a') as $e)
echo $e->href . "<br>";
?>