php


twitter api returns “not recognised” on image tweets


I am trying to post a tweet with image using the api, I followed the instructions at https://dev.twitter.com/rest/public/uploading-media-multiple-photos but it keeps returning
{"request":"/1.1/media/upload.json","error":"not recognized."}
My code is as follows:
I removed the tokens and secrets..
require('TwitterAPI.php');
$settings = array(
'oauth_access_token' => "",
'oauth_access_token_secret' => "",
'consumer_key' => "",
'consumer_secret' => ""
);
$url = 'https://upload.twitter.com/1.1/media/upload.json';
$requestMethod = 'POST';
$media_files = array(
'myimage.jpg'
);
$media_ids = array();
foreach ($media_files as $file) {
$postfields = array(
'media' => $file
);
}
$twitter = new TwitterAPI($settings);
$response = $twitter->buildOauth($url, $requestMethod)
->setPostfields($postfields)
->performRequest();
$media_ids[] = $response->media_id_string;
$media_ids = implode(',', $media_ids);

Related Links

Implement Facebook Login from ZERO
Check for a multiple amount of information in a database
PHP Time difference only display when not zero
Search in a container of objects with PHP
Please Check the Update Query is not working. I am new to Mysql please [duplicate]
php pdo db connection class
Running normal PHP scripts in Laravel 5
Count the number of vowels in an array in PHP
Account Register, custom ID page created, access with PHP and MySQL
sending Special chars (String) from android to php
Can a variable named as `$something` be referred to by `someting`, that is without the dollar sign?
Cannot login to php page when sql column type is changed from TEXT to varchar
Caesar Cipher not running as expected
User Profile Creation
PHP get time from personal identity number under 1970
Use Product Image as category Image in Virtuemart

Categories

HOME
jboss
nam
magento2
automapper
adfs3.0
livecode
add-on
subdomain
stacktrace.js
ant
jersey-2.0
gentelella
dji-sdk
bittorrent
u-boot
cisco
xamarin-zebble
multi-step
pinterest
user-defined-types
robolectric
gmp
renderscript
parceler
pfobject
coreldraw
gollum-wiki
batch-rename
pdf.js
tf-idf
envoy
winsock
steam-web-api
epplus
amazon-kms
ms-solver-foundation
installanywhere
text-decorations
android-n
iscroll
windows-store
export-to-pdf
cloudera-sentry
ipp-protocol
wysihtml5
spongycastle
amazon-elastic-beanstalk
gestures
spring.net
watir-webdriver
sequence-diagram
nslayoutconstraint
dex
bpms
pbx
java-2d
openquery
p6spy
gcloud-node
callouts
conan
fragmentstatepageradapter
vaadin4spring
distributed-cache
utf-16
gwt-syncproxy
i2b2
seadragon
management-studio-express
arbre
hmisc
unhandled
ipod
console.log
smacss
csslint
pageviews
sensormanager
frontbase
san
stty
dibs
asp.net-mvc-3-areas
reentrancy
icenium
dojo-1.9
popup-blocker
netstream
servercontrol
play2-mini
asp.net-mvc-views
dip
downgrade
mongrel
icicles
android-input-method
self-tracking-entities
browser-based
iphone-sdk-3.1.3
twitter-feed
datagridcolumn
prism-2
acceleration
rootkit

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile