Revision: 181
Updated Code
at July 1, 2006 13:00 by aravet
Updated Code
#1
response = http.get(\'/index.html\')
# using block
File.open(\'result.txt\', \'w\') {|f|
http.get(\'/~foo/\') do |str|
f.write str
end
}
#2
res = Net::HTTP.get_response(URI.parse(\'http://www.example.com/index.html\'))
print res.body
#3
res = Net::HTTP.get_response(\'www.example.com\', \'/index.html\')
print res.body
Revision: 180
Updated Code
at July 1, 2006 12:59 by aravet
Updated Code
response = http.get(\'/index.html\')
# using block
File.open(\'result.txt\', \'w\') {|f|
http.get(\'/~foo/\') do |str|
f.write str
end
}
res = Net::HTTP.get_response(URI.parse(\'http://www.example.com/index.html\'))
print res.body
or:
res = Net::HTTP.get_response(\'www.example.com\', \'/index.html\')
print res.body
Revision: 179
Updated Code
at July 1, 2006 12:58 by aravet
Updated Code
#reading html from an external URL
#http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
#http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
response = http.get(\'/index.html\')
# using block
File.open(\'result.txt\', \'w\') {|f|
http.get(\'/~foo/\') do |str|
f.write str
end
}
res = Net::HTTP.get_response(URI.parse(\'http://www.example.com/index.html\'))
print res.body
or:
res = Net::HTTP.get_response(\'www.example.com\', \'/index.html\')
print res.body
Revision: 178
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 30, -0001 00:00 by aravet
Initial Code
#reading html from an external URL
#http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
#http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
response = http.get(\'/index.html\')
# using block
File.open(\'result.txt\', \'w\') {|f|
http.get(\'/~foo/\') do |str|
f.write str
end
}
res = Net::HTTP.get_response(URI.parse(\'http://www.example.com/index.html\'))
print res.body
or:
res = Net::HTTP.get_response(\'www.example.com\', \'/index.html\')
print res.body
Initial URL
Initial Description
reference: \n http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
Initial Title
reading html from an external URL
Initial Tags
textmate, html, ruby
Initial Language
Ruby