How to get the latest news from twitter in php
This article describes the method of getting the latest news from twitter in php. Share it with everyone for your reference. The specific implementation method is as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
function get_status($twitter_id, $hyperlinks = true) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$src = curl_exec($c);
curl_close($c);
preg_match('/(.*)/', $src, $m);
$status = htmlentities($m[1]);
if( $hyperlinks ) $status = ereg_replace("[[:alpha:]] ://[^<>[:space:]] [[:alnum:]/]", " ", $status);
return($status);
}
?>
|
1
2
3
4
5
6
7
8
9
10
1112
13
|
<🎜>function get_status($twitter_id, $hyperlinks = true) {<🎜>
<🎜>$c = curl_init();<🎜>
<🎜>curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");<🎜>
<🎜>curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);<🎜>
<🎜>$src = curl_exec($c);<🎜>
<🎜>curl_close($c);<🎜>
<🎜>preg_match('/(.*)/', $src, $m);
$status = htmlentities($m[1]);
if( $hyperlinks ) $status = ereg_replace("[[:alpha:]] ://[^<>[:space:]] [[:alnum:]/]", "\0", $status);
return($status);
}
?>
|
http://www.bkjia.com/PHPjc/983319.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/983319.htmlTechArticleHow to get the latest news from twitter in php. This article describes the method of getting the latest news from twitter in php. Share it with everyone for your reference. The specific implementation method is as follows: 1 2 3 4 5 6 7 8 9 10...