Issues uploading photos through API


Hi all,

I am simply trying to upload and attach an image to a tweet using update with media and keep running in to the same error

‘{“errors”:[{“message”:“Sorry, that page does not exist”,“code”:34}]}’ (length=68)

I have tried several solutions online but can’t seem to crack it as I thought the process was quite simple. Sorry If I’m missing something obvious but any light you could shed on this would be awesome.


$twitteroauth = new TwitterOAuth(‘XXXXXXXXXXXXXXXX’, ‘XXXXXXXXXXXXXXX’, $_SESSION[‘oauth_token’], $_SESSION[‘oauth_token_secret’]);

$image = ‘image.jpeg’;

echo ‘Test’;

$code = $twitteroauth->oAuthRequest(
‘media[]’ => “@{$image};type=image/jpeg;filename={$image}”,
‘status’ => ‘Standard Tweet’,
true, // use auth
true // multipart

echo ‘Test’;


if ($code == 200) {
} else {
echo “try again”;


Strange, I verified that that endpoint works:

POST /1/statuses/update_with_media.json HTTP/1.1 Host: User-Agent: Go http package Content-Length: 15532 Authorization: OAuth .... Content-Type: multipart/form-data;boundary=963654e642a5c7439585cc4ee13bc65de98b85baa95ce1483914091701c5 Accept-Encoding: gzip

Content-Disposition: form-data; name=“status”

Hello 2012-10-12 13:43:25.580104 -0700 PDT!
Content-Disposition: form-data; name=“media[]”; filename="media.png"
Content-Type: application/octet-stream

It does look like the signature for oAuthRequest is
function oAuthRequest($url, $method, $parameters) {

Perhaps that’s the issue?