$html=file_get_html('http://twitter.com/search/realtime?q='.urlencode($param['q']).'+include:retweets&src=typd')or$this->returnError('No results for this query.',404);
}
elseif(isset($param['u'])){/* user timeline mode */
$html=file_get_html('http://twitter.com/'.urlencode($param['u']))or$this->returnError('Requested username can\'t be found.',404);
}
else{
$this->returnError('You must specify a keyword (?q=...) or a Twitter username (?u=...).',400);
}
foreach($html->find('div.tweet')as$tweet){
$item=new\Item();
$item->username=trim(substr($tweet->find('span.username',0)->plaintext,1));// extract username and sanitize