How can i post image along with text on timeline using PHP


I want to post image and text on my timeline.Here is my code :-

 $twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['TWITTER_token'], $_SESSION['TWITTER_token_secret']);
		$user_info = $twitteroauth->get('account/verify_credentials');
		$message = $_POST['message']; // I have added a message here
		$image = $_FILES ['file']  ['tmp_name'];
		$statuesIMAGE= $twitteroauth->post('statuses/update_with_media', array('media[]' => '@{$image}','status' => $message));

please reply/If some have sample(running code) please give me.Thanks


There is a full example under media.


i am using code (from your reference):–

$twitteroauth = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['TWITTER_token'], $_SESSION['TWITTER_token_secret']);
$media1 = $twitteroauth->upload('media/upload', array('media' => '../images/android.png'));
 $media2 = $twitteroauth->upload('media/upload', array('media' => '../images/ios.png'));
$parameters = array(
    'status' => 'Images',
    'media_ids' => implode(',', array($media1->media_id_string, $media2->media_id_string)),
$result = $twitteroauth->post('statuses/update', $parameters);
print_r( $result);

But it shows nothing.


hello sir please help me. i struct in this from 4 days back…Please reply ASAP


What do you mean it shows nothing? there should at least be some error of some sort.


it return blank screen.


That’s a PHP error, you need to turn on errors or look at the log and see why.