Connecting to facebook using a ruby app

require "net/http"

http = Net::HTTP.new('www.facebook.com', 80)resp = nil

cookie = String.new

http.start do |http|  request = Net::HTTP::Post.new('/')  request['referer'] = 'http://www.example.com/'

  request['user-agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008051206 Firefox/3.0'
  resp = http.request(request)
  cookie = resp['Set-Cookie']

end

puts resp

Comments are closed.