Reputation: 5087
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
The same code works in another hosting and returns http_code 200 . What could it be?
Upvotes: 0
Views: 238
Reputation: 80
Http Code 0 generally means it is either a TIME_OUT or you are not able to connect to the server
Upvotes: 1
Reputation: 5087
I found the reason of the problem, curl command inside the twitteroauth library doesnt work because outgoing connections are disabled in that hosting
Upvotes: 1
Reputation: 493
There is no such thing as an http code of 0.
What happens if you echo $connection
? What does that return? Http code of 0 means you'll need to check twitter oauth docs.
Upvotes: 0