note 111574 added to oauth.fetch
| From: | chris dot barr at ntlworld dot com | Date: | Tue, 05 Mar 2013 17:59:59 +0000 |
| Subject: | note 111574 added to oauth.fetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193947@lists.php.net to get a copy of this message | ||
The fetch() method will throw an OAuthException if the returned http status code is in the 4xx or
5xx range:
<?php
// Querying Twitter with bad login details
try {
$oauth->fetch('https://api.twitter.com/1.1/favorites/list.json');
}
catch(Exception $e) {
echo $e->getCode(); // 401
// Message generated by OAuth class
echo $e->getMessage(); // Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a
redirect)
// Message returned from Twitter
echo $e->lastResponse; // {"errors":[{"message":"Could not
authenticate you","code":32}]}
}
----
Server IP: 94.76.225.145
Probable Submitter: 109.231.193.170
----
Manual Page -- http://php.net/manual/en/oauth.fetch.php
Edit -- https://master.php.net/note/edit/111574
Del: integrated -- https://master.php.net/note/delete/111574/integrated
Del: useless -- https://master.php.net/note/delete/111574/useless
Del: bad code -- https://master.php.net/note/delete/111574/bad+code
Del: spam -- https://master.php.net/note/delete/111574/spam
Del: non-english -- https://master.php.net/note/delete/111574/non-english
Del: in docs -- https://master.php.net/note/delete/111574/in+docs
Del: other reasons-- https://master.php.net/note/delete/111574
Reject -- https://master.php.net/note/reject/111574
Search -- https://master.php.net/manage/user-notes.php