FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Http call returns image
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Http call returns image
Posted: Thu May 04, 2023 05: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
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Http call returns image
Posted: Thu May 04, 2023 05:27 PM
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Http call returns image
Posted: Thu May 04, 2023 05:29 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Http call returns image
Posted: Sat May 06, 2023 03: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 (fw): Select all Collapse
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

Continue the discussion