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

T

Tao Ji

Hello,
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}"
===============================================
 
P

pharrington

Hello,
Need your help to find out what stop my "open" action. I'm using
open-uri to get the webpages fromhttp://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}"
===============================================

Is the error you're getting "SocketError: getaddrinfo: Name or service
not known"?

If not, copy and paste the full error.
 

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,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top