Does abraham twitteroauth library work for update_with_media?

Does the abraham twitteroauth library work for update_with_media?

I use the code below, but it returns me a stdClass Object ([request] => /1/statuses/update_with_media.json [error] => Error creating status.)

session_start(); require_once('twitteroauth/twitteroauth.php'); require_once('config.php'); if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) { header('Location: ./clearsessions.php'); } $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,$_SESSION['access_token']['oauth_token'], $_SESSION['access_token']['oauth_token_secret']); $image = './images/5298.png'; $content = $connection->post('statuses/update_with_media', array( 'media[]' => '@{$image};type=image/jpeg;filename={$image}', 'status' => 'My current location')); include('html.inc'); 

Any idea how to solve this problem?

EDIT 1: I use https://upload.twitter.com/1/ as url

+2
source share
3 answers

Yes Yes! Modify the two Oauth.php and twitteroauth.php files as described in this link https://github.com/robhaswell/twitteroauth/commit/7f5bfd2450cb1cff71641d7ea55e118f5a42885d and use the download method $ connection-> similar to this.

  $params = array('media[]' => '@'.$image_url, 'status' => $messafe); $twit = $connection->upload('statuses/update_with_media',$params); 
+5
source

In accordance with the answer of the author of the library in another place - while it does not work with update_with_media.

TwitterOAuth does not currently support multimedia downloads. I hope to add support in the future. May 10 by @abraham at update_with_media using twitteroauth from Abraham

+2
source
  $params = array('media[]' => file_get_contents($image_url), 'status' => $messafe); $twit = $connection->upload('statuses/update_with_media',$params); 

Small change if update_with_media is not working

0
source

All Articles