function scrapeScroogle($query, $page){
$page = $page * 100;
$scroogle = "http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw=$query&n=1&z=$page";

$agent = "your useragent string here";
$ch = curl_init();
  
curl_setopt($ch, CURLOPT_URL, $scroogle);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8118"); //I use tor, but use whatever proxy you want...yes, you should use a proxy
curl_setopt($ch, CURLOPT_REFERER, $scroogle); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

$output = curl_exec($ch);
   
$dom = new DOMDocument();
@$dom->loadHTML($output);
	
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");
	
for ($i = 0; $i < $hrefs->length; $i++) {
	$href = $hrefs->item($i);
	$value[] = $href->getAttribute('href');
}
return $value;
}