Posting links to twitter
Is this possible? Everything I try to do comes out as text.
Re: Posting links to twitter
Just post a URL. On Tue, Nov 4, 2008 at 12:18 PM, dowhilesomething [EMAIL PROTECTED] wrote: Is this possible? Everything I try to do comes out as text. -- Alex Payne - API Lead, Twitter, Inc. http://twitter.com/al3x
Re: Posting links to twitter
On Nov 4, 8:18 pm, dowhilesomething [EMAIL PROTECTED] wrote: Is this possible? Everything I try to do comes out as text. As long as it looks like a url it seems to work, namely with the http:// I wrote a bit of code to tinyurl-ise any links http://github.com/matthewrudy/rudebay/tree/master/lib/rudebay/twitterer.rb ruby def self.make_tinyurl(link) url = URI.parse('http://tinyurl.com/api-create.php') req = Net::HTTP::Post.new(url.path) req.set_form_data('url' = link) res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } return res.body end
Re: Posting links to twitter
On Nov 4, 8:18 pm, dowhilesomething [EMAIL PROTECTED] wrote: Is this possible? Everything I try to do comes out as text. It works fine, as long as it recognises its a url. (I assume it uses the Rails auto_link, or something of that sort - http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001338) namely start the link with an http://; I wrote a bit of code to tinyurl any links ruby def self.make_tinyurl(link) url = URI.parse('http://tinyurl.com/api-create.php') req = Net::HTTP::Post.new(url.path) req.set_form_data('url' = link) res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } return res.body end http://github.com/matthewrudy/rudebay/tree/master/lib/rudebay/twitterer.rb enjoy. (apologies if I sent this twice) MatthewRudy