Using ruby, what is the easiest way to grab a single JPG image from an IP camera that requires authentication and write the image to a file? For example an IP camera that has uses a URL:
http://192.168.69.81/cgi/jpg/image.cgi
I don't need to perform any manipulation of the image.
Thanks in advance.
Open the remote location and write the file as a jpeg image called image.jpg:
require 'open-uri'
url = 'http://192.168.69.81/cgi/jpg/image.cgi'
open(url, :http_basic_authentication => ['username', 'password']) do |f|
open('image.jpg','wb') do |file|
file.puts f.read
end
end