Tweet clickable links with twitteroauth?

2019-07-23 18:39发布

问题:

I'm using twitteroauth from https://github.com/abraham/twitteroauth like this:

 $Twitter = new TwitterOAuth(...);
 $Twitter->post('statuses/update', array('status' => 'click <a href="http://google.com">here</a>'));

Tweeted URLs are shown as plain text and not clickable. How do I post a real Link?

回答1:

Have you tried posting the link with out the HTML markup and with http:// - posting http://www.google.com vs www.google.com, I'm using the same API and that seems to work for me, but creating the hyperlink as you would in HTML, doesn't seem to work. And now that that I think of it, I don't know that I've ever run across a hyperlink style link in Twitter or TweetDeck, just URL's that are run through a shortener...



回答2:

You don't need <a /> tag to post link to Twitter. Do it like this:

 $Twitter = new TwitterOAuth(...);
 $Twitter->post('statuses/update', array('status' => 'click here: http://google.com'));


回答3:

I think it's a Twitter issue, it escapes all HTML code: http://support.twitter.com/entries/13920-frequently-asked-questions#html