Home > Backend Development > PHP Tutorial > How to get the latest news from twitter in php_PHP tutorial

How to get the latest news from twitter in php_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 09:57:18
Original
861 people have browsed it

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

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); } ?>
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...
Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template