1

I would like to post from php to twitter using api 1.1. I have followed this post:

how to post tweet using twitter 1.1 api and twitteroauth

and it's step by step link solution

Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

but nothing happens. Should I change the REQUEST SETTINGS in the OAUTH TOOL tab to

request url: https://api.twitter.com/1.1/statuses/update.json

request type: post

and if so how do you do this? There seems to be no way to update this from the current

https://api.twitter.com/1/

get

enter image description here

here is the code for the post:

require_once('TwitterAPIExchange.php');
 /** Set access tokens here - see: https://dev.twitter.com/apps/ **/
  $settings = array(
  'oauth_access_token' => "",
  'oauth_access_token_secret' => "",
  'consumer_key' => "",
  'consumer_secret' => ""
);


  $url = 'https://api.twitter.com/1.1/statuses/update.json'; 
  $requestMethod = 'POST';


$postfields = array('status' => 'Hi This is a post' ); 

    $twitter = new TwitterAPIExchange($settings);

 echo $twitter->buildOauth($url, $requestMethod)
         ->setPostfields($postfields)
         ->performRequest(); 

This is as suggested in the link. I have of course added the relevant codes -tokens and secrets.

Any help appreciated.

Community
  • 1
  • 1
martyn
  • 230
  • 5
  • 22
  • This might be a daft question, but you are setting the values in $settings? You've just not put them in your question here - right? – DanSingerman Sep 17 '13 at 11:39
  • Yes this is what I meant by - I have of course added the relevant codes. – martyn Sep 17 '13 at 12:57
  • What's the result of calling that function, i.e. which is the error? Do you have, for instance, cURL installed? – sissi_luaty Sep 17 '13 at 17:05
  • I have the TwitterApiExchange.php, which is part of this [link]https://github.com/J7mbo/twitter-api-php . There is no error just a blank document. – martyn Sep 17 '13 at 17:19
  • No-one seems interested in this. Does everyone have it working? – martyn Sep 19 '13 at 06:24

0 Answers0