2

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?

Mattias
  • 9,211
  • 3
  • 42
  • 42
fanti
  • 1,859
  • 3
  • 16
  • 31

3 Answers3

3

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...

frosty
  • 769
  • 6
  • 18
  • escaping or removing html is also a security precaution, preventing iframes or script tags from injecting malicious code. – frosty Feb 29 '12 at 02:26
  • I spend some time on this before I found that the url should be of the form `http://[...].[...]` or `https://[...].[...]` and so http://localhost/ does not work. – mlunoe May 21 '13 at 08:24
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'));
mrpaint
  • 468
  • 3
  • 6
1

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

El Barto
  • 919
  • 1
  • 5
  • 18