Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @req = Curl::Easy.new("#{url}") do |c|
- c.follow_location = true
- c.verbose = true
- c.enable_cookies = true
- c.headers = {
- "User-Agent" => "IE 7 - Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)",
- "Accept" => "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*",
- "Accept-Language" => "en_us",
- #"Accept-Encoding" => "gzip, deflate",
- "Keep-Alive" => "300",
- "Connection" => "Keep-Alive",
- "Expect" => ""
- }
- c.cookiejar = "cookies.txt"
- end
- puts "Fetching #{url}"
- @req.cookiefile = "cookies.txt"
- @req.http_get
- puts "Redirected #{@req.redirect_count} times"
- #Store::Url.new(@req.last_effective_url)
- #Store::Doc.new(@req.body_str)
- #File.open('html.html', 'a') { |f| f.write(@req.body_str)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement