Get tweets from twitter account with php
//pass tweet content here to make link clickable in text
function make_twitter($tweetcontent) {
$tweetcontent = preg_replace("/((http)+(s)?:\/\/[^<>\s]+)/i", "\\0", $tweetcontent );
$tweetcontent = preg_replace("/[@]+([A-Za-z0-9-_]+)/", "\\0", $tweetcontent );
$tweetcontent = preg_replace("/[#]+([A-Za-z0-9-_]+)/", "\\0", $tweetcontent );
return $tweetcontent;
}
$tweets = json_decode(file_get_contents("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitter_username&count=3"));
function make_twitter($tweetcontent) {
$tweetcontent = preg_replace("/((http)+(s)?:\/\/[^<>\s]+)/i", "\\0", $tweetcontent );
$tweetcontent = preg_replace("/[@]+([A-Za-z0-9-_]+)/", "\\0", $tweetcontent );
$tweetcontent = preg_replace("/[#]+([A-Za-z0-9-_]+)/", "\\0", $tweetcontent );
return $tweetcontent;
}
$tweets = json_decode(file_get_contents("https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=twitter_username&count=3"));
No comments:
Post a Comment