2013-05-27 101 views
0

我有一个HybridAuth问题,我希望人们可以给我帮助。如何使用hybridAuth检查twitter状态更新是否成功

基本上,我用它来发布twitter更新,解释如下Here

问题是,我想检查推文是否发送成功。如果可能,最简单的方法是什么?我应该写一个函数吗?任何想法是值得赞赏

回答

0

当响应代码不是200所以,你可以做Twitter的更新抛出异常:

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 
} 

参见响应代码从Twitter列表:https://dev.twitter.com/docs/error-codes-responses

+0

啊!非常感谢,我喜欢那样,只是不确定是否抛出异常。非常感谢链接 – Ricki