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) } }
Updated the tmhOAuth library from GitHub again, and ensured cacert.pem was in the same directory of tmhOAuth fixed it eventually :)