• 0

Twitter API Help


Question

paulOr

<?php
// Set username and password
$username = 'paulOr';
$password = '*******';
// The message you want to send

// The twitter API address
$url = 'http://twitter.com/statuses/update.xml';
// Alternative JSON version
// $url = 'http://twitter.com/statuses/update.json';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer)) {
	echo 'message';
} else {
	echo 'success';
}
?>

I simply want it to say 'succes' or 'failure' upon login, if the username was correct or not, iv tryed playing around and stuff, but cant seem to stop it from saying success :p I dont need it to tweet or anything like that, just to know if the authentification was done.

Can anyone help :(

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
d3nuo

have you examined the output of $buffer? does it have anything useful inside it? i may play around with this in a bit to see if i can figure anything out.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.