Post Tweet Using Oauth

I am trying to create a web application that allows a user to post tweets from a form directly on a web page, instead of using their own built-in Twitter popup. The problem is that the code snippet that I am browsing over the network does not work:

$message = "Hello there! This is a tweet!";

$twitterObj->post('statuses/update', array('status' => "$message"));

And when I try to execute the code, I get this error:

Warning: invalid argument provided by foreach () in /twitter/EpiOAuth.php on line 76

Warning: http_build_query () [function.http-build-query]: Parameter 1 must be an array or an object. Invalid value specified in /twitter/EpiOAuth.php on line 140

I am building an example and using the OAuth library found at this web address:

http://www.jaisenmathai.com/articles/twitter-php-sign-in.html

Does anyone have any tips?


EDIT

! , , :

$twitterObj->post_statusesUpdate(array('status' => 'Message goes here.'));
+5
1

, :

$message = "Hello there! This is a tweet!";

$twitterObj->OAuthRequest('https://twitter.com/statuses/update.xml', array('status' => $message), 'POST');

, : https://github.com/abraham/twitteroauth

+2

All Articles