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 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置
  • ¥15 Matlab怎么求解含参的二重积分?
  • ¥15 苹果手机突然连不上wifi了?
  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用