Missing or invalid url parameter while posting image with twitter API -


i trying post image on twitter. image in server. here code

$tweet_img = '/home/voucherscode/public_html/editsocial/'.$tweet_img; $returnt = $connection->post('statuses/update_with_media', array(      'media[]' => file_get_contents($tweet_img),      'status' => "$tweet_msg"   )); 

but response

stdclass object( [errors] => array     (         [0] => stdclass object             (                 [code] => 195                 [message] => missing or invalid url parameter.             )     )) 

please help.

i got issue. using old twitteroauth , on post function has not multipart parameter.

i replaced twitteroauth https://github.com/tomi-heiskanen/twitteroauth/blob/77795ff40e4ec914bab4604e7063fa70a27077d4/twitteroauth/twitteroauth.php , works below code.

$tweet_img = '/home/voucherscode/public_html/editsocial/'.$tweet_img;  $handle = fopen($tweet_img,'rb'); $image = fread($handle,filesize($tweet_img)); fclose($handle);  $parameters = array('media[]' => "{$image};type=image/jpeg;filename={$tweet_img}",'status' => 'picture time');    $returnt = $connection->post('statuses/update_with_media', $parameters, true); 

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -