2013-08-06 32 views
0

我Twitter的API中使用「鏈接縮短」服務不好受PHP將圖像發佈到Twitter並鏈接到網頁?

https://dev.twitter.com/docs/tco-link-wrapper/faq

我的印象是,當它通過一個標準類型的鏈接應該自動成爲縮短,可點擊下通過API。然而,無論我如何發送鏈接,它始終是不可點擊的文本......永遠不會縮短,並始終與140的限制相抵消。

當使用1.1 api時,我們如何直接使用twitter來處理URL?

//this here is simply binary stuff uploaded and posted, using twitteroath library 
$media = ss_get_image_binary($file_attachment_path);    

$params = array(
    'media[]' => "{$media};type=image/jpeg;filename={$file_attachment_path}",   

);  

$resource_url = 'https://api.twitter.com/1.1/statuses/update_with_media.json'; 

環部:

//I'm making my own hashtags, and counting post length stuff myself... 
//the backlink variable here is just a typical http: link 
$hashtags = ss_make_hastags($tags, $id);  

$title = ss_twitter_status_format($image->post_title, $hashtags); 

$backlink = get_permalink($id); 

$params['status'] = $backlink . ' ' . $hashtags; 

//最後,一切都發布到Twitter

$connection = ss_twitter_communication_setup(); 

$tweet = $connection->post($resource_url, $params); 

的形象和地位張貼罰款。鏈接永遠不會變爲「活動」或可點擊。他們數到了140的限制。

一件事 -

這是類,一切都導致回,建立通信

$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret); 
+0

嘗試發佈您的代碼。 – Mike

回答

0

發現了問題:

LOCALHOST不起作用。

捂臉