Twitter OAuth Settings

ii silver ii

ǝɹıɟpǝʞɔı&
Dec 18, 2008
767
23
0
I'm using the following to try and get the new Twitter API running but no tweeting luck at the moment.

Code:
<?
require_once 'twitter/TwitterOAuth.php';

define('CONSUMER_KEY', '123');
define('CONSUMER_SECRET', '123');
define('OAUTH_TOKEN', '123');
define('OAUTH_SECRET', '123');

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);

$content = $connection->get('account/verify_credentials');

$connection->post('statuses/update', array('status' => 'This is a test status using the new API'));
?>

With the twitter/OAuth.php and twitter/TwitterOAuth.php that are recommended and obviously with the correct keys.

http://github.com/abraham/twitteroauth/zipball/0.2.0-beta3

However I'm having absolutely no luck with getting any updates, what am I doing wrong?
 


Try :

PHP:
$test = $connection->post('statuses/update', array('status' => 'This is a test status using the new API'));

var_dump($test);

and post the output.
 
Try :

PHP:
$test = $connection->post('statuses/update', array('status' => 'This is a test status using the new API'));

var_dump($test);
and post the output.

I doubly agree this should work in updating your status, but you can also drop the '$test =' part. Instead to see the output you could simply replace that with the 'echo' command.

Edit: I also just noticed this is not an official library wrote by twitter itself, so maybe it's out of date?

Edit2: Do you have cURL enabled?
 
I doubly agree this should work in updating your status, but you can also drop the '$test =' part. Instead to see the output you could simply replace that with the 'echo' command.

Edit: I also just noticed this is not an official library wrote by twitter itself, so maybe it's out of date?

Edit2: Do you have cURL enabled?

Well you could just dump $connection too, yes.
It was like 8 in the morning when I wrote that, ha.

The library works as described in the link I posted earlier in the thread, I'm using that exact thing on 8 twitter accounts and feeds.
 
Try :

PHP:
$test = $connection->post('statuses/update', array('status' => 'This is a test status using the new API'));

var_dump($test);

and post the output.

The output I got back... (keys replaced with 123)

Code:
object(TwitterOAuth)#1 (13) { ["http_code"]=> int(0) ["url"]=> string(46) "https://api.twitter.com/1/statuses/update.json" ["host"]=> string(26) "https://api.twitter.com/1/" ["timeout"]=> int(30) ["connecttimeout"]=> int(30) ["ssl_verifypeer"]=> bool(false) ["format"]=> string(4) "json" ["decode_json"]=> bool(true) ["http_info"]=> array(20) { ["url"]=> string(46) "https://api.twitter.com/1/statuses/update.json" ["content_type"]=> NULL ["http_code"]=> int(0) ["header_size"]=> int(0) ["request_size"]=> int(0) ["filetime"]=> int(-1) ["ssl_verify_result"]=> int(0) ["redirect_count"]=> int(0) ["total_time"]=> float(0) ["namelookup_time"]=> float(0) ["connect_time"]=> float(0) ["pretransfer_time"]=> float(0) ["size_upload"]=> float(0) ["size_download"]=> float(0) ["speed_download"]=> float(0) ["speed_upload"]=> float(0) ["download_content_length"]=> float(-1) ["upload_content_length"]=> float(-1) ["starttransfer_time"]=> float(0) ["redirect_time"]=> float(0) } ["useragent"]=> string(25) "TwitterOAuth v0.2.0-beta2" ["sha1_method"]=> object(OAuthSignatureMethod_HMAC_SHA1)#2 (0) { } ["consumer"]=> object(OAuthConsumer)#3 (3) { ["key"]=> string(20) 123" ["secret"]=> string(41) "123" ["callback_url"]=> NULL } ["token"]=> object(OAuthConsumer)#4 (3) { ["key"]=> string(50) "123" ["secret"]=> string(42) "123" ["callback_url"]=> NULL } }

Edit Reply: I also just noticed this is not an official library wrote by twitter itself, so maybe it's out of date?

It's the official demo on the Twitter api site so I guess so

Edit2: Do you have cURL enabled?

Curl is definitely enabled