dsafq2131321 2013-08-27 01:00
浏览 44
已采纳

如何让Twitter PHP类在IIS8上工作(卷曲问题?)

I decided to combine my website with my twitter account. In order to use it properly, I wanted to post a tweet. I decided to go with the very simple class TwitterAPIExchange from here: https://github.com/J7mbo/twitter-api-php

I tested it on my Linux server and it all works well. But I wanted to use this tool from my Windows server. This is my set up: Windows 2012, IIS 8, PHP.

Here my test code

// Setup
$settings = array( ... );
$url = 'https://api.twitter.com/1.1/statuses/update.json';

// Post the data
$requestMethod = 'POST';

$postfields = array('status' => 'Hello World');

$twitter = new TwitterAPIExchange($settings);
$json = $twitter->buildOauth($url, $requestMethod)->setPostfields($postfields)->performRequest();

var_dump($json);

On the windows machine, it returns

bool(false)

all the time! What does that mean? Is it an issue with curl and IIS? I read several articles online about it but none helped me so far. Any input is very appreciated!

  • 写回答

2条回答 默认 最新

  • duanjiwang2927 2013-08-28 20:42
    关注

    Curl gave me the following error:

    curl iis SSL certificate problem, verify that the CA cert is OK
    

    As I could not make it work with a certificate on IIS, I folllowed a hint given on a forum (http://board.phpbuilder.com/showthread.php?10253357-cURL-and-SSL-issues) which told me to add the following curl options:

    curl_setopt( $ch , CURLOPT_SSL_VERIFYPEER , false );
    curl_setopt( $ch , CURLOPT_SSL_VERIFYHOST , false ); 
    

    So in the end, I added this to the TwitterAPIExchange class where curl was used.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

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