themattharris/tmhOAuth — Issue #33: Getting User Info & Limit
Author: cypherD
Created: 2012-03-03 04:31:46+00:00
State: open

Hi Matt,

Thanks for the library - well done! So far it's been pretty smooth sailing - I can successfully, for example, authenticate and get the user's favorite tweets. But I'm stuck on a couple of points:

1) When I try to get the request limit I get the ip limit instead of the user limit. I'm using the following code (with a real username, but I also tried it without the username b/c the docs say you don't have to pass it - same result either way - I get the ip limit:

```php
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => $c_key,
'consumer_secret' => $c_secret,
'user_token' => $token,
'user_secret' => $secret,
));

$url = "https://api.twitter.com/1/account/rate_limit_status/[USERNAME].json";

$tmhOAuth->request("GET", $url);

if ($tmhOAuth->response['code'] == 200) {
$data = json_decode($tmhOAuth->response['response'], true);
} else {
$data = htmlentities($tmhOAuth->response['response']);
echo 'There was an error.' . PHP_EOL;
}
var_dump($data);
```

I can tell it's the ip limit because the max int in the response is 150. What am I missing here?

2) What is the proper/best way to get the current authenticated user's basic info (username, id, etc) using the library? When I make a request to:

https://api.twitter.com/1/account/verify_credentials.json

OR

https://api.twitter.com/1/account/verify_credentials/[USERNAME].json

... using the same code that I've been using for favorites and request limit, I get "Could not authenticate with OAuth". And when I replace $url with $tmhOAuth->url('1/account/verify_credentials') I get an "expired token" error, which doesn't make sense to me because I can use the same token to get a list of favorite tweets 10 seconds later.

I hope I'm not missing something really simple, but it's entirely possible - my brain is so fried.