New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HTTP403 / "Missing or invalid url parameter" issue with Twitter API ... #232

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@tomi-heiskanen

tomi-heiskanen commented Oct 2, 2013

Fix HTTP403 / "Missing or invalid url parameter" issue with Twitter API 1.1 update_with_media-method. Content-Type must be "multipart/form-data" and as result signature must be calculated from oauth-header parameters only.

tomi-heiskanen added some commits Oct 2, 2013

Fix HTTP403 / "Missing or invalid url parameter" issue with Twitter A…
…PI 1.1 update_with_media-method. Content-Type must be "multipart/form-data" and as result signature must be calculated from oauth-header parameters only.
@tomi-heiskanen

This comment has been minimized.

Owner

tomi-heiskanen commented on c7bfba4 Oct 2, 2013

There was an issue with merge, please see a424021

This comment has been minimized.

alokbanjare replied Oct 24, 2013

i have updated my libreary with the above changes to make image upload work but it is still not working

I am pasting my code below, please let me know if there is any issue with my code

$image = '@{http://www.example.com/assets/images/logo.jpg};type={image/jpeg};filename={Chrysanthemum.jpg}';

$parameters = array(
'status'=>'An auskhs array of megyhjgdia attached to the Tweet with the new Twitter Photo load.',
'media[]'=>$image
);

         $content_type = array('Content-Type'=>"multipart/form-data");

        $response = $CI->twconnect->tw_post(
                            'statuses/update_with_media',
                            $parameters,
                            $tw_access_token,
                            $content_type);

This comment has been minimized.

Owner

tomi-heiskanen replied Oct 24, 2013

I had to make three commits, please check that your file is similar to this version: https://github.com/tomi-heiskanen/twitteroauth/blob/77795ff40e4ec914bab4604e7063fa70a27077d4/twitteroauth/twitteroauth.php

It should work with no problems. What error do you get?

This comment has been minimized.

Owner

tomi-heiskanen replied Oct 24, 2013

Also, check if your tw_post-method calls the library's post-method with $multipart-parameter set true.

This comment has been minimized.

alokbanjare replied Oct 24, 2013

Thanks! It's working now, It was not working beacuse I was using direct image urls like http://www.example.com/logo.jpg in the code, I replaced this with $_FILES object

$image = "@{$_FILES['image']['tmp_name']};type={$_FILES['image']['type']};filename={$_FILES['image']['name']}"

and now its working fine for me.

But I wanted it to make it work with direct image urls without using $_FILES.

Still playing with this, Thanks again

This comment has been minimized.

pyranha replied Jan 7, 2014

Thanks for this!

But I still can't figure it out (probably because I am a noob at this)

this is the code I use:
$image = '@{'.$imageurl.'};type={'.$_FILES["img1"]["type"].'};filename={'.$filename1.'};';

$connection = new TwitterOAuth($config_twitter_consumer_key, $config_twitter_consumer_secret, $access_token, $access_token_secret );
$params = array( 'media[]' => $image, 'status' => 'test met plaatje');
print_r($params);
$twit= $connection->post('statuses/update_with_media',$params);
var_dump($twit);

this is the image array:
Array ( [media[]] => @{http://mysite.nl/cl_img/placed/52cc610d756c9.jpg};type={image/jpeg};filename={52cc610d756c9.jpg}; [status] => test met plaatje )

and I still get this response:
{ ["code"]=> int(195) ["message"]=> string(33) "Missing or invalid url parameter." }

what a'm i doing wrong??

thanks!

gr,

Ben

@ludar ludar referenced this pull request Oct 18, 2013

Open

Update with media issue #14

@abraham abraham added the Media label Aug 9, 2014

@abraham abraham closed this Jan 7, 2015

@TerjeBr

This comment has been minimized.

TerjeBr commented Oct 21, 2015

Why was this closed without merging?

I am having the same issue now.

@abraham

This comment has been minimized.

Owner

abraham commented Oct 21, 2015

This PR was closed because uploading media was added in a different PR. Make sure you are following the the instructions on https://twitteroauth.com/ for uploading media. If you are still having problems, open a new issue that what you are trying to do.

Repository owner locked and limited conversation to collaborators Dec 30, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.