doufen5175 2013-04-28 12:12
浏览 32

tmhOAuth永远不会返回任何东西,所以很困惑

Not even the most basic code below returns anything, running the latest versions of the tmhOAuth and tmhUtilities from GitHub, running that (with valid keys and secret copied from My applications in the Twitter Dev site - they are hidden for security purposes on here).

The page doesn't output anything at all, nothing... so confused? Does this script have any firewall issues with CSF/cPanel? I've tried pinging api.twitter.com from the server as root and that works fine.

Really struggling for ideas? Because it's worked before, then the next minute nothing happens at all.

A var_dump of $code returns NULL :/

<?php
require 'tmhOAuth.php';
require 'tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
  'consumer_key'    => '********',
  'consumer_secret' => '****************',
  'user_token'      => '********',
  'user_secret'     => '****************'
));

$code = $tmhOAuth->request('GET', $tmhOAuth->url('1/account/verify_credentials'));

if ($code == 200) {
  echo 'The access level of this token is: ' . $tmhOAuth->response['headers']['x_access_level'] . PHP_EOL;
  tmhUtilities::pr($tmhOAuth->response);
} else {
    tmhUtilities::pr(htmlentities($tmhOAuth->response['response']));
}

A var_dump of $tmhOAuth returns (keys hidden but valid):

object(tmhOAuth)#1 (3) { ["params"]=> array(0) { } ["auto_fixed_time"]=> bool(false) ["config"]=> array(19) { ["consumer_key"]=> string(22) "**********" ["consumer_secret"]=> string(42) "*********" ["user_token"]=> string(50) "********" ["user_secret"]=> string(43) "************" ["use_ssl"]=> bool(true) ["host"]=> string(15) "api.twitter.com" ["debug"]=> bool(true) ["force_nonce"]=> bool(false) ["nonce"]=> bool(false) ["force_timestamp"]=> bool(false) ["timestamp"]=> bool(false) ["oauth_version"]=> string(3) "1.0" ["curl_connecttimeout"]=> int(30) ["curl_timeout"]=> int(10) ["curl_ssl_verifypeer"]=> bool(false) ["curl_followlocation"]=> bool(false) ["is_streaming"]=> bool(false) ["streaming_eol"]=> string(2) " " ["streaming_metrics_interval"]=> int(60) } }
  • 写回答

1条回答 默认 最新

  • dongming6201 2013-04-28 12:49
    关注

    Updated the tmhOAuth library from GitHub again, and ensured cacert.pem was in the same directory of tmhOAuth fixed it eventually :)

    评论

报告相同问题?

悬赏问题

  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集
  • ¥15 在启动roslaunch时出现如下问题
  • ¥15 汇编语言实现加减法计算器的功能
  • ¥20 关于多单片机模块化的一些问题
  • ¥30 seata使用出现报错,其他服务找不到seata
  • ¥35 引用csv数据文件(4列1800行),通过高斯-赛德尔法拟合曲线,在选取(每五十点取1点)数据,求该数据点的曲率中心。
  • ¥20 程序只发送0X01,串口助手显示不正确,配置看了没有问题115200-8-1-no,如何解决?
  • ¥15 Google speech command 数据集获取
  • ¥15 vue3+element-plus页面崩溃