Advertisement
Guest User

Untitled

a guest
Jun 29th, 2009
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.89 KB | None | 0 0
  1.                 @req = Curl::Easy.new("#{url}") do |c|
  2.                     c.follow_location = true
  3.                     c.verbose = true
  4.                     c.enable_cookies = true
  5.                     c.headers = {
  6.                         "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)",
  7.                         "Accept" => "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*",
  8.                         "Accept-Language" => "en_us",
  9.                         #"Accept-Encoding" => "gzip, deflate",
  10.                         "Keep-Alive" => "300",
  11.                         "Connection" => "Keep-Alive",
  12.                         "Expect" => ""
  13.                     }
  14.                     c.cookiejar = "cookies.txt"
  15.                 end
  16.                 puts "Fetching #{url}"
  17.                 @req.cookiefile = "cookies.txt"
  18.                 @req.http_get
  19.                 puts "Redirected #{@req.redirect_count} times"
  20.                 #Store::Url.new(@req.last_effective_url)
  21.                 #Store::Doc.new(@req.body_str)
  22.                 #File.open('html.html', 'a') { |f| f.write(@req.body_str)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement