login = $user.':'.$pass; $this->user = $user; } //fetch tweets via cURL public function fetch_tweets($tweetlimit = 5, $charlimit = False, $limit= 42) { $ch = curl_init(); $login = $this->login; $target = 'http://twitter.com/statuses/user_timeline.xml'; curl_setopt($ch, CURLOPT_URL, $target); curl_setopt($ch, CURLOPT_USERPWD, $login); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //Parsing the data $getweet = curl_exec($ch); $twitters = new SimpleXMLElement($getweet); //error reporting if(array_key_exists('@attributes', $twitters)){ //die("Fatal Error Twitter is currently unavaliable"); } //echo each tweet that was fetched. $counter = 0; foreach ($twitters->status as $twit) { $twiturl = 'http://twitter.com/'. $this->user .'/statuses/'. $twit->id; $created = substr($twit->created_at,0,16); if(++$counter > $tweetlimit) { break; }else{ if($charlimit){ if(strlen($twit->text) > $charlimit) { $tweet = substr($twit->text, 0 , $limit)."..."; }else{ $tweet = substr($twit->text, 0 , $limit); } }else{ $tweet = $twit->text; } echo '