Hi,
I am trying to read content of url after doing http authentication.
using
the below code query string(UserID=1) is not passed properly in the
request.
I am new to ruby so please let me know what are the changes that
have to
be done
test_username=''testuser1''
test_password=''password''
url =
URI.parse(''http://www.someurl456.com/apps/GetName?UserID=1'')
req = Net::HTTP::Get.new(url.path)
req.basic_auth test_username, test_password
res = Net::HTTP.new(url.host, url.port).start {|http|
http.request(req) }
response=res.body
If http authentication is not required i can try:
response=open("http://www.someurl456.com/apps/GetName?UserID=1''").read
Thanks
Kiran
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
any solutions for this please? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rob Nichols
2007-Nov-28 12:15 UTC
Re: Passing Query String while doing http authentication
Kiran wrote:> any solutions for this please?This works for me. [code]http.start do |http| request = Net::HTTP::Get.new(instruction) request.basic_auth USERNAME, PASSWORD response = http.request(request) end[/code] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---