Http call returns image

Post Reply
User avatar
cdmmaui
Posts: 693
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
Contact:

Http call returns image

Post by cdmmaui »

Hello Everyone,

Can someone provide sample code that makes http request and that request returns a JPG image that I need to save on local HD?

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
karinha
Posts: 7884
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: Http call returns image

Post by karinha »

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
Antonio Linares
Site Admin
Posts: 42256
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Http call returns image

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Http call returns image

Post by nageswaragunupudi »

If the URL refers to a jpg image like this
"https://cdn.images.express.co.uk/img/dynamic/109/590x/Apple-links-587431.jpg"
We can save the jpg with just one function like this in one single line of code:

Code: Select all | Expand

cURL  := "https://cdn.images.express.co.uk/img/dynamic/109/590x/Apple-links-587431.jpg"
MEMOWRIT( "myfile.jpg", WebPageContents( cURL ) ) // This one line of code does the job

// Check if saved correctly
XIMAGE( "myfile.jpg" )
 
Note: The function WebpageContents( cUrl ) uses oHttp for reading the contents of any web-page
Regards

G. N. Rao.
Hyderabad, India
Post Reply