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 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化