Adding a cookie to http-access2 without using a cookie.dat

P

Paul Wolpe

Is there a way to add a cookie with http-access2 without having a
cookie.dat? I have one cookie that I want to set for every GET I do
and I don't want to have a cookie.dat file for this one value. I have
been unable to get the following (and some similar variations) to work.

Thanks,

Paul

require 'http-access2'

client = HTTPAccess2::Client.new

cookie = WebAgent::Cookie.new
cookie.parse("fakecookiename=xxxxxxxxxxxx;", "www.foo.com")
client.cookie_manager.cookies = [cookie]

# Get the page sending the "fakecookiename" key along
puts client.get_content("http://www.foo.com/")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top