Sha256: a4d75a170d1a3519920b494a33bfa359abb0d6653c18af914632644e832a3b31

Contents?: true

Size: 463 Bytes

Versions: 2

Compression:

Stored size: 463 Bytes

Contents

# download picture
def downloadpicture
	require 'net/http'
	require 'uri'
	uri = @a_urlpicturename
	begin
		uri_parse = URI.parse(uri)
		host = uri_parse.host
		path = uri_parse.path
		response = nil

		http = Net::HTTP.start(host) 


		response = http.get(path)

		data = response.body
		File.open("/tmp/test.jpg", "w") { |f| f.write(data) }
		@listpicturesfromtmp = "picture downloaded"

	rescue
		@listpicturesfromtmp = "error retrieving #{uri}:"
	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rwdmovies-0.94 code/superant.com.rwdmovies/downloadpic.rb
rwdmovies-0.95 code/superant.com.rwdmovies/downloadpic.rb