dongpangfu6322 2016-12-19 21:35
浏览 19

无法使用PHP Twitter API发布

I am using TwitterAPIExchange to publish tweets to Twitter. Over the last 4 months I had no problems until I switched from HTTP to HTTPS.

I did not think this would be a problem as I do not even see this as a setting within the Developers APP and I am doing all this through crontab.

I am using the identical code below on two different servers and the one with SSL I get a successful connection (no errors) but no posting of the tweet -- meanwhile on the server without SSL I get a successful connection and a successful post.

Can a IP get blocked and if so, how do I check it if is, or is SSL a problem -- what do I need to do to fix this?

require_once('TwitterAPIExchange.php');
$connection = array('oauth_access_token' => 'xxx', 'oauth_access_token_secret' => 'xxx', 'consumer_key' => 'xxx', 'consumer_secret' => 'xxx');
try {
    $twitter = new TwitterAPIExchange($connection);
    echo 'Connection success <br /> ';
    $response = $twitter->buildOauth('https://api.twitter.com/1.1/statuses/update.json', 'POST')->setPostfields(array('status' => 'Test Tweet'))->performRequest();
    $json = json_decode($response, true);
    if (!empty($json['id_str'])) echo 'Post success: '.$json['id_str'];
}
catch (Exception $ex) {
    echo $ex->getMessage();
}
  • 写回答

1条回答 默认 最新

  • 「已注销」 2016-12-19 21:57
    关注

    Added CURLOPT_SSL_VERIFYPEER => false to TwitterAPIExchange

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度