Why this web page stop my "open" action [open-uri]?

Need your help to find out what stop my “open” action. I’m using
open-uri to get the webpages from http://quotes.163.com. When I try open
other pages it works pefectly but spit out errors when I try to get the
stock quote information.

Can you give me some hints?

Below is my sample code:

require “open-uri”
url_news = “http://news.163.com/10/0204/01/5UL33070000120GR.html” # a
normal news page from 163.com
url_600036 = “http://quotes.163.com/corp/1036/code=600036.html” # a
stock info page from 163.com, this is problematic page
url_blank = “http://news.163.com/10/0204/01/5UL22070000120GR.html” # a
request to a nonexisted page
#response = open(url_news) # I can go smoothly
#response = open(url_blank) # also no error
response = open(url_600036) # Yes error comes here
puts “Character set is #{response.charset}”
puts “Size is #{response.size}”

On Feb 3, 10:50 pm, Tao Ji [email protected] wrote:

require “open-uri”
puts “Size is #{response.size}”

Posted viahttp://www.ruby-forum.com/.

Is the error you’re getting “SocketError: getaddrinfo: Name or service
not known”?

If not, copy and paste the full error.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs