I am trying to open a URI using doc = Nokogiri::HTML(open(url)). I get the following error: URI::InvalidURIError: bad URI(is not URI?): http://www.mauipropertytax.com/Datalets.asp?mnu=PSearch&submnu=Profile&pin=390350950000&tp=2&cp=1&State=1|1|*&item=1 from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:436:in `split'' from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:485:in `parse'' from /usr/local/ruby/lib/ruby/1.8/open-uri.rb:29:in `open'' The problem is, if I paste the url in a browser it does go to the proper page. What am I missing --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jan 27, 2009, at 8:35 PM, Don French wrote:> I am trying to open a URI using doc = Nokogiri::HTML(open(url)). I get > the following error: > > URI::InvalidURIError: bad URI(is not URI?): > http://www.mauipropertytax.com/Datalets.asp?mnu=PSearch&submnu=Profile&pin=390350950000&tp=2&cp=1&State=1 > |1|*&item=1 > from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:436:in `split'' > from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:485:in `parse'' > from /usr/local/ruby/lib/ruby/1.8/open-uri.rb:29:in `open'' > > The problem is, if I paste the url in a browser it does go to the > proper page. What am I missingTry replacing the | characters with %7C Or try: doc = Nokogiri::HTML(open(URI.encode(url))) -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That worked perfectly. Thanks Don On Jan 27, 4:22 pm, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Jan 27, 2009, at 8:35 PM, Don French wrote: > > > I am trying to open a URI using doc = Nokogiri::HTML(open(url)). I get > > the following error: > > > URI::InvalidURIError: bad URI(is not URI?): > >http://www.mauipropertytax.com/Datalets.asp?mnu=PSearch&submnu=Profil... > > |1|*&item=1 > > from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:436:in `split'' > > from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:485:in `parse'' > > from /usr/local/ruby/lib/ruby/1.8/open-uri.rb:29:in `open'' > > > The problem is, if I paste the url in a browser it does go to the > > proper page. What am I missing > > Try replacing the | characters with %7C > > Or try: > > doc = Nokogiri::HTML(open(URI.encode(url))) > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---