【问题标题】:How to check if twitter status update was a success using hybridAuth如何使用 hybridAuth 检查 twitter 状态更新是否成功
【发布时间】:2013-05-22 13:16:06
【问题描述】:

我遇到了 HybridAuth 的问题,希望人们可以帮我解决。

基本上,我用它来发布 Twitter 更新,正如 Here 解释的那样。

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

【问题讨论】:

    标签: php twitter hybridauth


    【解决方案1】:

    twitter更新在响应码不是200的时候会抛出异常。所以你可以这样做:

    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

    【讨论】:

    • 啊!非常感谢,我喜欢那样,只是不确定它是否引发了异常。也非常感谢您的链接
    猜你喜欢
    • 1970-01-01
    • 2018-08-29
    • 2012-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多