Tuesday, August 04, 2009

PHP CURL Based Twitter Feed for websites when fopen() is not allowed

<?php
// twitFeed.php
// curl based twitter feed
// 04Aug09
$url = 'http://twitter.com/statuses/user_timeline.xml?screen_name=thesuccess';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
print "<pre>".curl_exec ($ch);
curl_close ($ch);
?>

Labels: , , , , ,

Twitter Feed for Older Versions of ColdFusion (ie without CFFeed)

<cfset feedurl="http://twitter.com/statuses/user_timeline.xml?screen_name=thesuccess" />

<cfhttp URL="#feedurl#"
Method="get"
THROWONERROR="NO"
>
<pre>
<cfoutput>#cfhttp.FileContent#</cfoutput>

The output is an XML feed

Labels: , , , ,