-
-
Save anonymous/d130ebd2c00e32608d9e98eb4881cd59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
require "uri" | |
require 'nokogiri' | |
uri = URI.parse("http://limepepper.co.uk/test.xml") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
response = http.request(request) | |
doc = Nokogiri::XML(response.body) | |
links = doc.css("a") | |
puts links.length | |
links.each do |link| | |
puts link.text # => Click here | |
puts link["href"] # => http://www.google.com | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment