php - Abraham twitteroauth response parsing -
i'm having heck of time figuring out how parse out error message when twitter throws error. here's code, works fine post tweet:
$response = $twitteroauth->post('statuses/update', array('status' => $msg)); $e = $twitteroauth->http_code;
if $e != 200
, want twitter's error message. if var_dump($response)
, like
object(stdclass)#6 (1) { ["errors"]=> array(1) { [0]=> object(stdclass)#7 (2) { ["code"]=> int(187) ["message"]=> string(21) "status duplicate" } } }
how parse out message
status duplicate
?
if need 1 message value should work. $message = $response->errors[0]->message;
Comments
Post a Comment