/ Published in: Rails

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
require 'net/http' require 'rexml/document' url = 'http://weather.yahooapis.com/forecastrss?p=RSXX0438&u=c' xml_data = Net::HTTP.get_response(URI.parse(url)).body doc = REXML::Document.new(xml_data) titles = [] doc.elements.each('rss/channel/item/yweather:condition') do |ele| print ele.attributes['temp'] end
Comments
