function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, "http://" + CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); return $data; } foreach ($scraper as $scr) { scraperwiki::attach($scr); $qry = "* from " . $scr . ".swdata"; //echo $qry; $arr = scraperwiki::select($qry); // print_r($arr); foreach ($arr as $d) { // print $d["key"]; // print $d["site"]; $pr = (int) getPagerank($d["url"]); if (1) { $d_key = $d["key"]; $d_site = $d["site"]; //print_r($d["url"]." PR is ". (string)$pr ." site is ".$d_site); // ." key is " . $d_key); $record = array('url' => utf8_encode($d["url"]), 'pr' => utf8_encode($pr), 'ar' => utf8_encode($d["rank"]), 'id' => utf8_encode($d_key), 'desc' => $d["site"]); #print_r($record); scraperwiki::save_sqlite(array("id"), $record, "prank"); } } }
$pos = strpos($data, "Rank_"); if ($pos === false) { } else { $pagerank = substr($data, $pos + 9); return $pagerank; } } function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser. curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); return $data; } $arr = scraperwiki::select("* from poollist.pool"); //print_r($arr); //$url='http://www.brightyoursite.com'; foreach ($arr as $d) { //print $d["country"]; //print $d["years_in_school"]; $pr = getPagerank($d["dsn"]); if ($pr > 2) { echo $d["dsn"] . " PR is " . $pr; $record = array('pr' => $pr, 'dsn' => $d["dsn"]); scraperwiki::save_sqlite(array("pr", "dsn"), $record, "prank"); } }