Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

C, Need Help [ Fetch Text From Online ]

Hello,

Suppose I have a file online which contains a string of 10 length and I want to get this string into my C program and store it into local variable C.

I don't want to use CURL for this. Looking for something windows oriented solution.

I found something online for sockets but I couldn't figure it out. So any help please ?

Thanks
Personally, I would go with libcurl (even on Windows, there is a difference between curl (the client) and libcurl (the library) ), but given the fact you are specifically looking for a WIndows oriented solution: try URLDownloadToFile(W/A)

https://msdn.microsoft.com/en-us/library/ms775123.aspx

EDIT: This will be more useful for your situation:

https://stackoverflow.com/a/12374407
(Nov 9, 2017 02:08 AM)SIM-3547942 Wrote:  Personally, I would go with libcurl (even on Windows, there is a difference between curl (the client) and libcurl (the library) ), but given the fact you are specifically looking for a WIndows oriented solution: try URLDownloadToFile(W/A)

https://msdn.microsoft.com/en-us/library/ms775123.aspx

EDIT: This will be more useful for your situation:

https://stackoverflow.com/a/12374407

He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction.

InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(Nov 9, 2017 12:10 PM)0xDEAD10CC Wrote:  He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction.

InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle

Thanks for pointing me out to the right direction. Working on these functions to get my program up
(Nov 9, 2017 12:10 PM)0xDEAD10CC Wrote:  He doesn't want to save to file so InternetReadFile is the proper function (WinInet). And why use curl if he wants it Windows specific? It's going to be better than using a bloated library like curl which was designed for cross platform use. Much easier than Winsock too if you don't need to do anything fancy either so that SO link isn't truly the greatest point of direction.

InternetOpen, InternetConnect, HttpOpenRequest, InternetReadFile, InternetCloseHandle

Wow, thanks for the heads up. You are right - the use of libcurl probably is a bit too much. This seems like a much better option for his use-case.
(Nov 11, 2017 03:09 AM)SIM-3547942 Wrote:  Wow, thanks for the heads up. You are right - the use of libcurl probably is a bit too much. This seems like a much better option for his use-case.

Winsock is kind of a pain too (for something so trivial) unless you need to manipulate the requests on a socket-level, which in most cases for downloading HTTP content, is not very necessary. If you're doing some kind of multicast stuff or things like SSDP, then it might make more sense to have that level of control.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by FlexagonV2Aug 6, 2018 06:43 PM 11 376 Aug 6, 2018 06:43 PM
Last Post: FlexagonV2
[.NET] by SuliumJul 29, 2018 09:33 PM 1 174 Jul 29, 2018 09:33 PM
Last Post: SpookedOnion
[Python] by miseregoJul 21, 2017 07:07 AM 10 277 Jul 21, 2017 07:07 AM
Last Post: Riԁdle