How can I download a file using browser APIs in Linux?
There is an API in windows called URLDownloadToCacheFile
that downloads data to the Internet cache and returns the file 开发者_开发百科name of the cache location for retrieving the bits.
Is there any API (C/C++) in linux that downloads a file from internet?
There are some libraries (eg. curl, ...) that useful for downloading but I want a simpler API that does not deponds on any other libraries except browser.
Note that I want a C/C++ API, not a command line tool.
Thanks
A browser is an external application. On a typical Linux system, there's nothing which has the status comparable to that of IE on Windows. You can use Firefox as your browser; you can also completely uninstall Firefox and use only Chrome; you can even use w3m exclusively and no single GUI-based browser.
You seem to be somewhat confused about the differences between Windows and other operating systems.
There's no monolithic "browser" or "Internet cache" built into linux. In Windows you're simply using a function from a library they provide, but it's integrated into the OS (along with Internet Explorer).
There's really no parallel in linux. The OS is not tightly coupled with applications running on it. Using cURL, etc is how you approach what you're trying to do.
Like the other answers noted, there is no such thing as a built-in HTTP API on Linux systems, and you should be quick to accept that you need a HTTP library to do the task. But fear not, linking to libraries and deploying programs linked to libraries is much easier and less error-prone than under windows systems, so library dependencies are not that much of an issue.
libcurl is a well-established solution for HTTP and HTTPS.
精彩评论