Last active
September 14, 2018 14:08
-
-
Save jonlambert/3b22fc0eb4702a665420 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' | |
def fetch | |
puts "Super Simple (Shakespearian) Question Fetcher (v1.0)" | |
puts "(c) Mr J. Outer-Whipsy 2014 (All rights reserved)" | |
puts "Refreshing questions..." | |
url = URI.parse('http://h4inschools.schoolsbroadcast.org.uk/v1/orad/source.xml') | |
req = Net::HTTP::Get.new(url.path) | |
res = Net::HTTP.start(url.host, url.port) {|http| | |
http.request(req) | |
} | |
xml = res.body | |
File.open('/Users/sm/Desktop/open.xml', 'w') { |file| | |
file.write(xml) | |
puts "Saved. Waiting...\n" | |
} | |
sleep 10 | |
fetch | |
end | |
fetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment