twitteroauth 连接 returns http_code 0
twitteroauth connection returns http_code 0
require_once('oauth/twitteroauth.php');
require_once('config.php');
include_once('simple_html_dom.php');
if (CONSUMER_KEY === '' || CONSUMER_SECRET === '') {
echo 'You need a consumer key and secret to test the sample code. Get one from <a href="https://twitter.com/apps">https://twitter.com/apps</a>';
exit;
}
/* Start session and load library. */
session_start();
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
echo $connection->http_code; // it returns 0
相同的代码在另一个主机和 returns http_code 200 中有效。可能是什么?
没有 http 代码 0 这样的东西。
如果你 echo $connection
会怎样?那 return 是什么意思? Http 代码为 0 表示您需要查看 Twitter oauth 文档。
我找到了问题的原因,twitteroauth 库中的 curl 命令不起作用,因为在该主机中禁用了传出连接
Http 代码 0 通常表示它是 TIME_OUT 或者您无法连接到服务器
require_once('oauth/twitteroauth.php');
require_once('config.php');
include_once('simple_html_dom.php');
if (CONSUMER_KEY === '' || CONSUMER_SECRET === '') {
echo 'You need a consumer key and secret to test the sample code. Get one from <a href="https://twitter.com/apps">https://twitter.com/apps</a>';
exit;
}
/* Start session and load library. */
session_start();
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
echo $connection->http_code; // it returns 0
相同的代码在另一个主机和 returns http_code 200 中有效。可能是什么?
没有 http 代码 0 这样的东西。
如果你 echo $connection
会怎样?那 return 是什么意思? Http 代码为 0 表示您需要查看 Twitter oauth 文档。
我找到了问题的原因,twitteroauth 库中的 curl 命令不起作用,因为在该主机中禁用了传出连接
Http 代码 0 通常表示它是 TIME_OUT 或者您无法连接到服务器