开发者

Advice on google/twitter search from iphone using php/json

开发者 https://www.devze.com 2023-01-22 10:27 出处:网络
<?php header(\'Content-type: 开发者_如何学Goapplication/json\'); $json = file_get_contents(\"http://twitter.com/status/user_timeline/lindsaylohan.json?count=1\");
<?php
header('Content-type: 开发者_如何学Goapplication/json');
$json = file_get_contents("http://twitter.com/status/user_timeline/lindsaylohan.json?count=1");
$temp = json_decode($json);
$array = Array();
$array[] = $temp;
echo json_encode($array);
?>

I have a JSON parser in my iphone app. I'm using the above PHP code to try and search Twitter. Can anyone tell me the best way to search the web or get twitter results and return them to my app? I've tried YQL but could not get on with it. All i want is raw text returned to my app. Almost like RSS feeds


The ability to search is built right into the Twitter API. See the documentation for the search method here: http://apiwiki.twitter.com/Twitter-Search-API-Method:-search

For example, you could search for StackOverflow at this address: http://search.twitter.com/search.json?q=twitter

What do you mean when you say you want "raw text" though? The contents of a tweet are inherently structured, so Twitter does not provide an API that returns an unstructured copy of one. Is there a particular reason why decoding the JSON (or ATOM) formats doesn't work for your purpose?

0

精彩评论

暂无评论...
验证码 换一张
取 消