themattharris / tmhOAuth

An OAuth 1.0A library written in PHP
Apache License 2.0
855 stars 335 forks source link

Rate limiting headers #201

Open jonnymets opened 4 years ago

jonnymets commented 4 years ago

Hi all. I'm trying to ensure my code is safe when it comes to Twitter rate limiting. Twitter should be returning headers to help with this:

The code should be returning this via $tmhOAuth->response['headers'] however I'm not seeing those in there. Anybody else seeing this? There a specific way to access these I'm not seeing? Thanks for the help in advance!

sykezz commented 4 years ago

I'm able to see the rate limit headers. Are you getting any response from the endpoints?

$tmhOAuth->user_request([
  ...
]);
print_r($tmhOAuth->response['headers']);
...
  "HTTP/1.1 200 OK" => ""
  "status" => "200 OK"
  "strict-transport-security" => "max-age=631138519"
  "x-access-level" => "read-write-directmessages"
  "x-content-type-options" => "nosniff"
  "x-frame-options" => "SAMEORIGIN"
  "x-rate-limit-limit" => "15"
  "x-rate-limit-remaining" => "9"
  "x-rate-limit-reset" => "1580232465"
  "x-response-time" => "227"
...