Jump to content
1 minute ago, AmbarChakrabarti said:

Oops, I thought you wanted the software... I misread you... Sorry

Haha, that's alright. It's just I can't find a piece of code that can do it.

http://www.cplusplus.com/forum/beginner/92733/

http://stackoverflow.com/questions/4652417/how-to-download-a-file-from-a-server

 

Nothing works.

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7891934
Share on other sites

Link to post
Share on other sites

you make an HTTP request where you receive the pages HTML

then you parse for any and all img tags in it

and then you make an HTTP request on those images whose response you save to the file as a byte array

CPU: Intel i7 5820K @ 4.20 GHz | MotherboardMSI X99S SLI PLUS | RAM: Corsair LPX 16GB DDR4 @ 2666MHz | GPU: Sapphire R9 Fury (x2 CrossFire)
Storage: Samsung 950Pro 512GB // OCZ Vector150 240GB // Seagate 1TB | PSU: Seasonic 1050 Snow Silent | Case: NZXT H440 | Cooling: Nepton 240M
FireStrike // Extreme // Ultra // 8K // 16K

 

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7891942
Share on other sites

Link to post
Share on other sites

1 minute ago, DXMember said:

you make an HTTP request where you receive the pages HTML

then you parse for any and all img tags in it

and then you make an HTTP request on those images whose response you save to the file as a byte array

Um.. hahaha I didn't understand anything there. I am so very new to C++.

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7891946
Share on other sites

Link to post
Share on other sites

8 minutes ago, DXMember said:

you make an HTTP request where you receive the pages HTML

then you parse for any and all img tags in it

and then you make an HTTP request on those images whose response you save to the file as a byte array

Never mind, I just need to find code on how to make a HTTP request.

There is nothing without errors! God damn it!

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7891974
Share on other sites

Link to post
Share on other sites

Simplest way is to use a library like libcurl: https://curl.haxx.se/libcurl/

 

Otherwise you'll have to implement the whole protocol yourself (not worth it).

 

You could also delegate to another program such as wget (exec wget from within your own program).

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7892322
Share on other sites

Link to post
Share on other sites

It's really not that hard, the example given in this SO thread shows you only need a few lines of code:

http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c

 

The hardest part for a beginner will be to learn how to include a 3rd party library but this is a skill you will need again and again so spending the time to learn this is worth it.

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7892407
Share on other sites

Link to post
Share on other sites

2 minutes ago, Unimportant said:

It's really not that hard, the example given in this SO thread shows you only need a few lines of code:

http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c

 

The hardest part for a beginner will be to learn how to include a 3rd party library but this is a skill you will need again and again so spending the time to learn this is worth it.

This will be able to be exported in a singular exe file and run perfectly fine anywhere else when inputted?

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7892429
Share on other sites

Link to post
Share on other sites

It's simple. Just scrape the page, parse the html, find the image you are looking for, request the image from the website, scrape the response and store it in a byte array. Save the byte array as a file with ."YourImageTypeHere" after the name in the path string. Since you're using .Net, you can do that all without writing hardly any code using the WebClient class and regex.

Why do you need to do that anyway?

ENCRYPTION IS NOT A CRIME

Link to comment
https://linustechtips.com/topic/610179-c-how-do-i-download/#findComment-7892630
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×