hash->error == 'User not found' ) { $arrResponse[$intIndex] = null; } else { foreach ( $objXml->status as $status ) { if ( ( false == $bolShowAtUsername && '@' != substr( $status->text, 0, 1 ) ) || ( true == $bolShowAtUsername ) ) { $arrResponse[$intIndex] = array('tweet' => (string) $status->text, 'name' => (string) $status->user->screen_name, 'avatar' => (string) $status->user->profile_image_url, 'date' => (string) strtotime( $status->created_at ) ); break; } } } } // end: retrieve data from the xml data structure catch( Exception $e ) { echo 'Oops, the Twitter site appears to be down at the moment. Please try again later. Error: '.$e."\n"; return false; } } else { echo 'One or more Tweets have been disabled for XSS security reasons.'."\n"; return false; } $intIndex++; } update_option( TWITTER_USER_DATA, $arrResponse ); return true; } // end: MAIN FUNCTION function fetchXML( $strElement ) { $strUrl = 'http://twitter.com/statuses/user_timeline/'.$strElement.'.xml'; $resCurl = curl_init( $strUrl ); if ( false == $resCurl ) { echo 'Twitter Curl Function failed to initialise.'; return false; } curl_setopt( $resCurl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $resCurl, CURLOPT_HEADER, false ); curl_setopt( $resCurl, CURLOPT_CONNECTTIMEOUT, 3 ); curl_setopt( $resCurl, CURLOPT_TIMEOUT, 300 ); $strRsp = curl_exec( $resCurl ); if ( false == $strRsp ) { $strError = curl_error( $resCurl ); echo 'Twitter Curl Function failed to execute: '.$strError; return false; } curl_close( $resCurl ); return $strRsp; } ?>