iosfreak
iosfreak

Reputation: 5238

Help with tweet media entities

I just came across Tweet Entities and I want to add it to my tweets! I have read over and over in the API, but I still can't get it to work. This is what I have:

$entities = array(
    "media_url" => $picture_url,
    "url" => $short_url,
    "type" => "photo"
);
$status = $connection->post('statuses/update', array('status' => $twitterStatus, 'include_entities' => 1, 'entities' => $entities));

Part of print_r($status) includes:

[entities] => stdClass Object ( 
    [user_mentions] => Array ( ) 
    [hashtags] => Array ( ) 
    [urls] => Array ( 
        [0] => stdClass Object ( 
            [url] => http://myf.la/sh/9nlex 
            [indices] => Array ( 
                [0] => 6 
                [1] => 28 
            ) 
            [expanded_url] => 
        ) 
    ) 
) 
[retweet_count] => 0 
[place] => 
[in_reply_to_user_id] => 
[in_reply_to_status_id] =>

What else do I have to add in my entities array? You can't add everything the docs asks you too.

I think it's a known issue since it's a new API. Read here.

Upvotes: 2

Views: 1495

Answers (2)

Dhamu
Dhamu

Reputation: 1752

Using OAuth method you can do the POST statusesupdate_with_media..

Just download this example and check

I posted about this last week.. check this and download sample code

Change the config.php key from your Twiiter App

<?php
    define('API_KEY', '');/*Your Consumer key*/
    define('API_SEC','');/*Your Consumer secret*/
?>

Run index.html file you can see the form to POST the twitter update...

Upvotes: 0

zerkms
zerkms

Reputation: 254886

No, you don't need to specify your media (entities) manually - twitter will extract it automatically.

http://api.twitter.com/1/statuses/show/82425283357052929.xml?include_entities=1 --- here is my recent tweet, with entities.

Upvotes: 1

Related Questions