以下の最も基本的なコードでさえ何も返さず、GitHub から tmhOAuth と tmhUtilities の最新バージョンを実行し、それを実行します (有効なキーとシークレットを Twitter 開発サイトのマイ アプリケーションからコピーしました - ここではセキュリティ上の目的で非表示にしています)。
ページには何も出力されません。何も出力されません...とても混乱していますか? このスクリプトには、CSF/cPanel に関するファイアウォールの問題がありますか? サーバーからルートとして api.twitter.com に ping を実行してみましたが、問題なく動作します。
本当にアイデアに苦労していますか?以前は機能していたので、次の分には何も起こりません。
$code の var_dump は 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']));
}
$tmhOAuth の var_dump が返します (キーは非表示ですが有効です):
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) } }