Posted by alct on Wed 18th Nov 19:15
download | new post | report as spam
- <?php
- /*
- * A simple PHP get-latest-tweet script
- * Author : Andrew 'Akhilleus' Loconte
- * http://andreloconte.com
- * http://twitter.com/alct
- */
- function latestTweet() {
- $dir = 'tw_cache/';
- $fileName = 'latest.php';
- $latest = $dir . $fileName;
- $udpateFreq = $update + 600; // 10 minutes
- $user = 'USERNAME'; // username
- $password = 'PASSWORD'; // password
- $ch = curl_init('https://twitter.com/statuses/user_timeline.xml');
- curl_setopt($ch, CURLOPT_HEADER, 1);
- curl_setopt($ch,CURLOPT_TIMEOUT, 30);
- curl_setopt($ch,CURLOPT_USERPWD,$user . ':' . $password);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- {
- return 'Houston, we\'ve got a problem.';
- }
- || ((curl_exec($ch)) === FALSE))
- {
- }
- else {
- $result = curl_exec($ch);
- $xml = new SimpleXMLElement($data);
- $latestTweet = $xml->status[0]->text;
- }
- }
- ?>
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily
.After submitting an amendment, you'll be able to view the differences between the old and new posts easily
