How can I get response status from post request?


#1

I have token and I send a post request to add members into my authenticated account’s twitter lists. I am using “POST lists/members/create_all” to call the request. What it returns is a user object but I cant see whether the call is successful or failed. Sometimes it fails to add users to list but returns with same user object.
What I need to know are following?
How can get the status code or header information from the return?

My code are following:

$tw_token = new TwitterOAuth(‘fsdfsdf’,‘sdfsdfa’, ‘fsdfsd’, ‘fsfasdf’);

$list_obj = $tw_token->get(‘lists/show’, array(‘list_id’ => 23423423));

$status = $tw_token->post(‘lists/members/create_all’, array(‘screen_name’ => $users, ‘list_id’ => $list_id ));

Here: tokens, list id are fake. $user is a comma separated screennames.