Friday, 23 August 2013

Abraham twitteroauth response parsing

Abraham twitteroauth response parsing

I'm having a heck of a time figuring out how to parse out the error
message when twitter throws an error. Here's my code, which works fine to
post a tweet:
$response = $twitteroauth->post('statuses/update', array('status' =>
$msg)); $e = $twitteroauth->http_code;
If $e != 200, I want to get twitter's error message. If I
var_dump($response), I get something like
object(stdClass)#6 (1) { ["errors"]=> array(1) { [0]=> object(stdClass)#7
(2) { ["code"]=> int(187) ["message"]=> string(21) "Status is a duplicate"
} } }
How do I parse out that "message" "Status is a duplicate"?
Thanks

No comments:

Post a Comment