function httpTestAction() { YuppLoader::load('core.http', 'HTTPRequest'); $url = 'http://www.imdb.com/find?s=all'; $req = new HTTPRequest(); $req->setTimeOut(5); $res = $req->HTTPRequestPost($url, array('q' => 'The+Matrix')); return $this->renderString($res->getBody()); }
public function getNewsFromTwitterAction() { YuppLoader::load('core.http', 'HTTPRequest'); $req = new HTTPRequest(); $req->setTimeOut(20); $res = $req->HTTPRequestGet('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=ppazos&trim_user=1'); //print_r($req); //print_r($res); if ($res->getStatus() == '200') { $json = $res->getBody(); } else { $json = '[]'; } header('Content-Type: application/json'); return $this->renderString($json); }