The Search API does not support authentication and so TwitterOAuth does not
currently support it. TwitterOAuth uses https://api.twitter.com/1/ as the
API URL when the Search API uses http://search.twitter.com as documented
http://dev.twitter.com/doc/get/search.
To use the Search API I recommend performing a simple cURL request instead.
Also in general TwitterOAuth requests should formated like
$query = $twitteroauth->get("search", array("q" => $q, "rpp" =>100)>;
instead of
$query = $twitteroauth->get("search.json?q={$q}&rpp=100");
Finally the integers returned are larger then 32bit PHP supports. In
officially supported Twitter API methods most id elements have a matching
id_str element that is a string.
Abraham
-------------
Abraham Williams | Hacker Advocate | abrah.am
<http://abrah.am>Just launched from Answerly <http://answerly.com>:
InboxQ<http://inboxq.com>for Chrome
@abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.
On Mon, Feb 28, 2011 at 10:15, Chris Sobolewski
<[email protected]>wrote:
> I am attempting to use the twitteroauth library to make a query, and I
> am getting some odd responses back.
>
> My code:
> $twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
> $q=urlencode("#twitter");
> $query = $twitteroauth->get("search.json?q={$q}&rpp=100");
> echo "<pre>";
> $qq = $query;
> print_r($qq);
> echo "</pre>";
>
> First odd result is, when I try doing a JSON decode, I get an error
> that it is not JSON which is what I expected to get back.
>
> Second odd result is when I print_r, this is what I recieve back:
>
> stdClass Object
> (
> [created_in] => 0.11146
> [statuses] => Array
> (
> [0] => 4.2285483207823E+16
> [1] => 4.2285478212403E+16
> [2] => 4.2285477021237E+16
> [3] => 4.228546655225E+16
> [4] => 4.2285444607648E+16
> [5] => 4.2285433509528E+16
> [6] => 4.2285433383559E+16
> .... so on all the way down to 100
> )
> )
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>
--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
http://groups.google.com/group/twitter-development-talk