2013-08-06 34 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不起作用。

捂脸