Skip to content

Instantly share code, notes, and snippets.

@nuke99
Created September 2, 2012 21:54
Show Gist options
  • Save nuke99/c5a69499b042991ae2b2 to your computer and use it in GitHub Desktop.
Save nuke99/c5a69499b042991ae2b2 to your computer and use it in GitHub Desktop.
require 'net/http'
require 'net/https'
require 'uri'
url = 'http://localhost:81/index.php?id=1'
url = URI.parse(url)
headers = {
'Cookie' => 'cookie',
'Referer' => 'http://google.com/',
'Content-Type' => 'application/x-www-form-urlencoded',
'User-Agent' => 'New'
}
http = Net::HTTP.new(url.host, url.port.to_i)
request = Net::HTTP::Get.new(url.request_uri,headers)
begin
response = http.request(request)
rescue Timeout::Error,Errno::ECONNREFUSED => e
puts "time out"
end
p response.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment