'; /** * A little 'controller' to make this sample page work: * */ if(isset($_GET['p']) && $_GET['p'] != '') { $p = $_GET['p']; $out = "Spider $p
"; $html = download_pretending($p,"Yellowbrickroad"); $a = pc_link_extractor($html); $out .= "

Links on page: " . count($a) . "

"; if ( find_adsense($html)) { $out .= "Found Adsense"; } print_r($a); //$out .= $html; } else { // If an empty search was given: $out = (isset($_GET['p']) && $_GET['p'] == '') ? '

Please enter a search term

':''; // Show the form: $out .= $form; } echo $out; //echo "Raw Data -
" . print_r($data); function download_pretending($url,$user_agent) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec ($ch); curl_close ($ch); return $result; } function find_adsense($html) { #looking for #