Http call returns image

Http call returns image

Postby cdmmaui » Thu May 04, 2023 5:19 pm

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
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Http call returns image

Postby karinha » Thu May 04, 2023 5:27 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Http call returns image

Postby Antonio Linares » Thu May 04, 2023 5:29 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Http call returns image

Postby nageswaragunupudi » Sat May 06, 2023 3:50 pm

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 view
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
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests