#.rb
require 'open-uri'
require 'Nokogiri'
...
#@data_url = "http://localhost/"
#@data_url = "http://localhost:3000/"
@data_url = "http://127.0.0.1/"
@page = Nokogiri::HTML((@data_url),nil,'euc-kr')
@send = @page.css("div.footer-info01").text
#.html.rb
<h1><%=@page%></h1>
<div><%=@send%></div>
Information about www.xxx.com other than localhost can be scraped When you run from the source above, an infinite wait appears.
Can't nokogiri read the localhost page? Is it because of the approach?
ruby ruby-on-rails nokogiri
Local servers can, of course, be read. I think you should check first to see if the local server is properly bound to be accessible with 127.0.0.1 IP, and if the port is 80 ports.
© 2024 OneMinuteCode. All rights reserved.