Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:47:42+00:00 2026-05-27T20:47:42+00:00

Not sure why I’m getting the following error when the URI works just fine

  • 0

Not sure why I’m getting the following error when the URI works just fine in the browser:

http://oracleofbacon.org/cgi-bin/xml?a=Kevin Bacon&b=Tom Cruise&u=1&p=google-apps

This is my code:

def kb(to)

    uri = "http://oracleofbacon.org/cgi-bin/xml?a=Kevin Bacon&b=#{to.strip}&u=1&p=google-apps"
    doc = Nokogiri::XML(open(uri)) # throws error on this line

    return parse(doc)
end

I get the following error:

in `split': bad URI(is not URI?): http://oracleofbacon.org/cgi-bin/xml?a=Kevin Bacon&b=Tom Cruise&u=1&p=google-apps (URI::InvalidURIError)`

I execute the method in the following way:

kb("Tom Cruise")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:47:42+00:00Added an answer on May 27, 2026 at 8:47 pm

    It’s because a browser is pathologically friendly, like a puppy, and will go to great lengths to render a page or resolve a URL. An application won’t do that because you have to tell it how to be friendly.

    Your URL is not valid because it has embedded spaces. Replace the spaces with %20:

    irb -f
    irb(main):001:0> require 'open-uri'
    => true
    irb(main):002:0> open('http://oracleofbacon.org/cgi-bin/xml?a=Kevin%20Bacon&b=Tom%20Cruise&u=1&p=google-apps').read
    => "<?xml version=\"1.0\" standalone=\"no\"?>\n<link><actor>Tom Cruise</actor><movie>A Few Good Men (1992)</movie><actor>Kevin Bacon</actor></link>"
    

    Escaping the characters needing to be escaped is easy:

    irb -f
    irb(main):001:0> require 'uri'
    => true
    irb(main):002:0> URI.escape('http://oracleofbacon.org/cgi-bin/xml?a=Kevin Bacon&b=Tom Cruise&u=1&p=google-apps')
    => "http://oracleofbacon.org/cgi-bin/xml?a=Kevin%20Bacon&b=Tom%20Cruise&u=1&p=google-apps"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not sure if I've just missed something but this doesn't work: $(this).children('td.threadtitle a').html('thread title');
not sure what is wrong with this jquery code: http://jsfiddle.net/aCABM/ I want to to
Not sure why but I am not getting anything back from the json call.
Not sure entirely what is happening, but I get the following errors from Internet
Not sure what I'm missing here but this code runs without any error message,
Not sure what is wrong with parameter 3 or the setup? error C2440: 'type
Not sure why the images won't center: http://jsfiddle.net/xtian/BEXDG/ <div class=topic-tracker-info> <div class=container> <ul> <li>
Not sure what is going on. When I perform the following code... it runs
Not sure if I worded this correctly ... but I have the following code:
Not sure what the problem is here, but I keep getting the result of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.