Skip to content

Instantly share code, notes, and snippets.

@phsacramento
Created April 7, 2016 20:39
Show Gist options
  • Save phsacramento/1db88ed9a556e6d9f983e480f1973e97 to your computer and use it in GitHub Desktop.
Save phsacramento/1db88ed9a556e6d9f983e480f1973e97 to your computer and use it in GitHub Desktop.
Crawler Example
require 'uri'
require 'net/http'
url = URI("http://www.domaingames.com.br/Ajax_Funcoes.asp?IsNovoCfg=true&Busca=Exeggcute&Funcao=BuscaAvancada&Pagina=1")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["content-length"] = '108'
request["content-type"] = 'application/x-www-form-urlencoded'
request["referer"] = 'http//www.domaingames.com.br/Busca_Avancada.asp?q=Exeggcute'
request["cookie"] = 'Basket=Balcao=False&Endereco=&Shipping=; ChaveCarrinho=Aviso1=0&Aviso2=0&Data=&GiftCard=&Chave=1G1CWYP6ACFRJROJV257P7WIGEL6EW5AYU7%2D4%2D2016%2D16%2D57%2D20; ASPSESSIONIDASBBSBBR=JAAJMDPCPMEJDEKMJGIKGKKP; SalvaMostrarProduto=1; __utmt=1; __utma=53724861.1825031384.1460059042.1460059042.1460059042.1; __utmb=53724861.27.10.1460059042; __utmc=53724861; __utmz=53724861.1460059042.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); ID%5FUsuario='
request["origin"] = 'http//www.domaingames.com.br'
request["cache-control"] = 'no-cache'
response = http.request(request)
puts response.read_body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment