php – twitter api 1.1 – 返回NULL

我正在尝试使用Twitters API来检索一个hashtagged结果列表 – 它曾经非常简单,因为它们不需要身份验证,但现在它对我来说变得棘手……

我已经关注了这篇文章https://stackoverflow.com/questions/12916539/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1/15314662#=

但是当我加载我的页面时它只显示NULL – 我相信我已经完成了所有事情

注意 – 下面的PHP文件文件TwitteraPIExchange位于同一目录中

帮助将不胜感激

<?PHP
ini_set('display_errors', 1);
require_once('TwitteraPIExchange.PHP');

/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
    'oauth_access_token' => "xxxxx",
    'oauth_access_token_secret' => "xxxxx",
    'consumer_key' => "xxxxx",
    'consumer_secret' => "xxxxx"
);

$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?screen_name=j7mbo';
$requestMethod = 'GET';

$twitter = new TwitteraPIExchange($settings);
$response = $twitter->setGetfield($getfield)
                    ->buildOauth($url, $requestMethod)
                    ->performRequest();
var_dump(json_decode($response));
?>

解决方法:

添加CURLOPT_SSL_VERIFYPEER =>对于TwitteraPIExchange.PHP中的performRequest()方法中的CURL选项,为false.这似乎解决了它.

cf here

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...