Hi guys,
I have been using winhttp to download pages (openrequest, sendrequest etc.) However I dont know how to download images from these webpages at the same time using winhttp. Is it possible? If it is, could please direct me to the api or post an example?
Thanks
Harsha Reddy
You're going to need to parse the HTML and look for the <img src=... /> tags. Strip the URL out of that. If it's a fully qualified name (i.e. of the form "http://www.mysite.com/images/some-folder/picture.png"), then you're going to have to open a connection to the other server and download it from there. (You may be able to get your current server to get the file for you, but I've never tried it. I think it requires HTTP 1.1, not sure.) If it's a relative URL like images/some-folder/picture.png then you can download it from the current server.
sudo rm -rf /
Hey,
So after getting the connection again to required server, can I just use the winhttpreaddata to get the image ?
Thanks again for the reply.
Regards,
Harsha
It's the same as reading a webpage, if I recall correctly. You're going to have to look at the Content-Transfer-Encoding and Content-Type headers to check what you got back in case you need to convert it. You're probably going to get some sort of MIME header like image/png or whatever, and the Content-Transfer-Encoding header should be either base64 or 8bit (doubtful but possible).
sudo rm -rf /
ya i figured yesterday that it is the same as reading a page. Anyhow thanks a lot for your help
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks