define_method(:url_data) { |url| return (open((buf = "\0" * 1024).sub(/\0+$/, ""), 'rb') { |f| f.read }).to_s if Win32API.new('Urlmon', 'URLDownloadToCacheFile', 'ippiii', 'i').call(0, "#{url}?#{rand(10)}", buf, 1024, 0, 0) == 0 } if require('win32api')
puts(url_data("http://www.baidu.com/"))
define_method(:url_data) { |url| return (open((buf = "\0" * 1024).sub(/\0+$/, ""), 'rb') { |f| f.read }).to_s if Win32API.new('Urlmon', 'URLDownloadToCacheFile', 'ippiii', 'i').call(0, "#{url}?#{rand(10)}", buf, 1024, 0, 0) == 0 } if require('win32api')
puts(url_data("http://www.baidu.com/"))