Domanda

I have an issue with HybridAuth that i was hoping people could give me help with.

Basically, I use it to post twitter updates as explained Here.

Problem is, I wanted to check whether the tweet was sent successfully. What would be the easiest way to do this, if it is at all possible? Should I write a function? Any ideas are appreciated

È stato utile?

Soluzione

The twitter update throws an exception when the response code is not 200. So you can do:

try{
// update the user status  
$adapter->setUserStatus( "Hi there! this is just a random update to test some stuff" );
} 
catch(Exception $e)
{
  //echo 'Message: ' .$e->getMessage();
  // code for failure here
}

See also the list of response codes from twitter: https://dev.twitter.com/docs/error-codes-responses

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top