My first post, thank you for your support and cheerful welcome
I am new to both Twitter API and PHP, but have managed (thanks to the information found on the Web) to successfully tweet (with image), retweet, update profile image but fail with profile background image update.
Looking on the net I have found many discussions and examples, but all of them use the ‘image’ => ‘@filename’ which is no more supported if I do understand correctly.
– when @ used, tmhOAuth states : Deprecated: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class
I have tried to build a
$image_curlfile = new CurlFile('C:\path\test.JPG', 'image/jpg', 'test.JPG');
… but don’t know how to provide this to ‘image’, googling this gives no result.
The API (https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image) states that the image must be “provided as raw multipart data, not a URL”. This is not clear to me even after looking on the web for hours, thus my call for help. Future responses will surely provide an update for update_profile_background_image calls.
I am using tmhOAuth, and make use of PHP through command lines, not a form.
Code extract :
$code = $this->tmhOAuth->request( 'POST', $this->tmhOAuth->url('1.1/account/update_profile_background_image'), array( 'image' => base64_encode(file_get_contents('C:\Users\Thomas\Desktop\Eric.JPG')), 'tile' => true, 'use' => true, 'include_entities' => false, 'skip_status' => true ), true, // use auth true // multipart );
$code values to 200, but the profile background is not updated on twitter’s page.
Can you please share advice or piece of code which actually works at date (novembre 2013) ?