Setting multiple cookies for open-uri

I am trying to figure out how I would use ['set-cookie']

to add multiple cookies to a request for a web page. If I had the cookies in the array as such:

cookie1 = {'domain': 'Website', 'name': 'xyz', 'value': 'ASH', 'path': '/', 'httpOnly': False, 'secure': False}

cookie2 = {'domain': 'Website', 'name': 'xyz', 'value': 'ASH', 'path': '/', 'httpOnly': False, 'secure': False}


page = Nokogiri::HTML(open("a webpage"), "User-Agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36", "Cookie" => cookie1['set-cookie'] cookie2['set-cookie']) 

      

I have struggled to find documentation on how this integrates into open-uri.

+3


source to share





All Articles