0

I tried to do a http get for the website http://www.shopyourway.com using ruby Net::HTTP.get, but I got an error with code 512. And I tried to do a get with ssl for url "https://www.shopyourway.com". It just followed a redirection to the url without ssl.

code is as below:

uri = URI('https ://www.shopyourway.com') #space between https and : does not exist
body = Net::HTTP.get(uri)

I can browse the url using browser. But why I can't do a http get for that url?

Thanks

1 Answers1

0

finally get this to works, need to add couple headers to the Get request.

  uri = URI('http://www.shopyourway.com/today')
  req = Net::HTTP::Get.new(uri)
  req['Upgrade-Insecure-Requests'] = '1'
  req['Connection'] = 'keep-alive'
  req['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36'