Skip to content

Instantly share code, notes, and snippets.

@PirosB3
Created August 5, 2011 11:11
Show Gist options
  • Save PirosB3/1127325 to your computer and use it in GitHub Desktop.
Save PirosB3/1127325 to your computer and use it in GitHub Desktop.
require "net/http"
request = Net::HTTP.new("grooveshark.com")
path = '/more.php?getCountry'
data = '{"method":"getCountry"}'
headers = {'Host' => 'grooveshark.com',
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:5.0.1) Gecko/20100101 Firefox/5.0.1',
'Accept-Encoding' => 'gzip, deflate',
'Accept-Charset' => 'utf-8',
'Connection' => 'keep-alive'
}
resp, data = request.post(path, data, headers)
puts resp.body.force_encoding("utf-8")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment