使用 SimpleXML 获取 Twitter 提要和显示信息 [英] Get Twitter feed and display information using SimpleXML

查看:25
本文介绍了使用 SimpleXML 获取 Twitter 提要和显示信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于线程使用PHP preg_match_all,得到值href,我正在尝试从 Twitter 提要中获取一些信息.

Based on the thread With PHP preg_match_all, get value of href, I'm trying to get some information from a twitter feed.

这是提要网址(用于测试目的):推特供稿

Here is the feed url (for testing purpose): Twitter feed

这是我的代码:

function parse_feed($process) {
        $xml  = @simplexml_load_string($process);
        $findTweet = $xml['entry'];
    return $findTweet;
}

$username = 'tweet';
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=2";

$feed = file_get_contents($feed);
    //echo $feed;
print_r(parse_feed($feed));

我以前从未使用过 SimpleXML 或使用过 XML.

I never used SimpleXML before or worked with XML.

有人可以帮我吗?

推荐答案

这个站点可能是一个好的开始 http://www.php.net/manual/en/simplexml.examples-basic.php

this site might be a good start http://www.php.net/manual/en/simplexml.examples-basic.php

这篇关于使用 SimpleXML 获取 Twitter 提要和显示信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆