Home > php教程 > php手册 > body text

php获取twitter最新消息的方法

WBOY
Release: 2016-06-13 09:07:10
Original
1562 people have browsed it

php获取twitter最新消息的方法

 本文实例讲述了php获取twitter最新消息的方法。分享给大家供大家参考。具体实现方法如下:

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:]/]", "\\0", $status);

return($status);

}

?>

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!