Skip to content

Instantly share code, notes, and snippets.

@levinotik
Created November 2, 2011 20:40
Show Gist options
  • Save levinotik/1334845 to your computer and use it in GitHub Desktop.
Save levinotik/1334845 to your computer and use it in GitHub Desktop.
require 'net/https'
require 'uri'
uri = URI.parse("https://android.apis.google.com/c2dm/send")
req = Net::HTTP::Post.new(uri.path)
data = {'registration_id'=> '24323423423423ewfasfsfasfsfddsf',
'collapse_key' => '0',
'data.payload' => 'samplepayload'}
req.set_form_data(data, {'Authorization' => 'GoogleLogin auth=SID=blablarandom23432424'})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == "https"
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
resp = http.request(req)
puts req.body
puts resp.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment