What's the simpliest way to fetch HTML in a string?

时间:2015-10-30 21:50:46

标签: c++ winapi

I am looking for the very simplie way to fetch HTML body of a remote web site into a string using default C++ libraries or WinAPI.

2 个答案:

答案 0 :(得分:0)

There are no default C++ libraries to do this. And I'm not familiar with WinAPI. But check out the libcurl website here: http://curl.haxx.se/libcurl/. That site has a listing of "competitor" libraries that may be of use.

答案 1 :(得分:0)

查看Microsoft的WinInet API:

  

Microsoft Windows Internet(WinINet)应用程序编程接口(API)使应用程序能够访问标准Internet协议,例如FTP和HTTP。为了便于使用,WinINet将这些协议抽象为高级接口。

或Microsoft的WinHTTP API:

  

Microsoft Windows HTTP服务(WinHTTP)为开发人员提供HTTP客户端应用程序编程接口(API),以通过HTTP协议将请求发送到其他HTTP服务器。

它们都内置于Windows中。您只需在代码中链接到wininet.dllwinhttp.dll,然后#include wininet.hwinhttp.h,并根据需要调用相关的HTTP功能。