/** Perform a Google Search @return array of results */ static function search($q) { $base = 'http://ajax.googleapis.com/ajax/services/search/web'; $args = array('q' => $q, 'v' => '1.0', 'key' => self::$API_KEY, 'rsz' => 'large', 'start' => 0); $page = Radix_HTTP::get(sprintf('%s?%s', $base, http_build_query($args))); $json = json_decode($page['body']); return $json; // Radix::dump($json,true); // if (!empty($json->responseData->cursor->estimatedResultCount)) { // $c = intval($json->responseData->cursor->estimatedResultCount); // } // $list = array(); // if ( (!empty($json->responseData->results)) && (is_array($json->responseData->results)) ) { // foreach ($json->responseData->results as $i=>$x) { // $item = array( // 'q' => $q, // 'uri' => $x->url, // 'src' => 'google', // 'g-name' => $x->titleNoFormatting, // 'g-note' => $x->content, // 'g-rank' => (self::$_google_off + $i + 1), // ); // self::_page_save($item); // self::$_google_off++; // } // } }
/** Gets the User Time Line */ public static function getUserTimeline($user, $size = 10) { $uri = sprintf('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=%s&count=%d', $user, $size); $feed = Radix_HTTP::get($uri); $json = json_decode($feed['body']); return $json; }