J7mbo / twitter-api-php

The simplest PHP Wrapper for Twitter API v1.1 calls
MIT License
1.82k stars 800 forks source link

Can't retrieve rate_limit_status. I am receiving 403 (forbidden) #56

Closed lordspace closed 10 years ago

lordspace commented 10 years ago

I have tried to get app limits but I am receiving 403 (forbidden). 'message\' => \'Could not authenticate you\', \'code\' => 32,

$url = 'http://api.twitter.com/1.1/application/rate_limit_status.json';
$requestMethod = 'GET'; $qry = '?resources=statuses'; $twitter = new TwitterAPIExchange($settings);

    $res = $twitter->buildOauth($url, $requestMethod)
                 ->setGetfield($qry)
                 ->performRequest();
J7mbo commented 10 years ago

Try $res = $twitter->setGetfield($qry)->buildOauth($url, $requestMethod)->performRequest();

lordspace commented 10 years ago

Still shows 403

array ( 'status' => 0, 'msg' => '', 'result' => '', 'simple_result' => 'HTTP/1.1 403 Forbidden content-length: 0 date: Sun, 02 Feb 2014 20:43:07 UTC server: tfe set-cookie: guest_id=v1%3A139137378762058622; Domain=.twitter.com; Path=/; Expires=Tue, 02-Feb-2016 20:43:07 UTC x-rate-limit-limit: 180 x-rate-limit-remaining: 177 x-rate-limit-reset: 1391374652', )

P.S. I forked the project and applied some fixes e.g. curl not to verify SSL because it was failing. https://github.com/orbisius/twitter-api-php

lordspace commented 10 years ago

oh, ok. My bad. When I switched to https it showed the limits. Why would it make a difference?

J7mbo commented 10 years ago

@lordspace That'll be because of Twitter's latest changes restricting api.twitter.com to SSL/TLS traffic only, as of Jan 14th 2014.