Thursday, June 3, 2010

Making a http/https post request

Spent an hour to find out how to send a https post request and this is how ..

require 'rubygems'
require 'net/http'
require 'net/https'
require 'uri'
http ='', 443)
http.use_ssl = true
path = "/oauth/access_token"
data = 'id=123456'
resp, data =, data)
puts resp.inspect
puts data.inspect


Waqas said...

Thanks buddy.

I lost 2 days to reach at this blog. And really glad that my problem is solved using your code.

Accept my heartiest regards.

Waqas said...

I lost 2 days in posting some data to an API until I reached this post and bingo! it worked like a charm.

Accept a big thanks and my heartiest regards.


superluminary said...

Had the same problem for about the last hour. I love the Graph API.

kts said...


Solved my problem with oauth2 not posting parameters <3