0
我想在php中使用simplexml解析twitter上rss feed的用户名。总共有16个名字,所以我想使用foreach循环来运行解析每一个并返回它们。我唯一的问题是foreach循环。解析并通过foreach循环显示每个节点
$url = file_get_contents("http://search.twitter.com/search.atom?q=basketball");
$source = simplexml_load_string($url);
foreach ($source as $match){
$output = $match->name(0)->nodeValue = substr($match->name(0)->nodeValue, 0, strpos($match->name(0)->nodeValue, ' '));
echo $output;
}
请输入'$ source' – diEcho 2011-03-26 08:05:36