Sunday, 13 January 2013

How to fetch Twitter latest updates using PHP?

many a times we need to fetch twitter updates on to our business website or elsewhere.

This is can very well achieved using the following lines of code.



echo $text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $tweet->status[0]->text);


Also if when we need to with our wordpress site

//Set parameter for query string
$username = 'techoguru';
$num = '10';
// Get the data from Twitter JSON API
$json = wp_remote_get("$username&count=$num");
// Decode JSON into array
$data = json_decode($json['body'], true);
//Create unordered list
echo '';


No comments:

Post a Comment