HTTP 클라이언트 라이브러리가 필요합니다. 많은 클라이언트 중 하나는 libcurl
입니다. 그런 다음 URL에 GET
요청을 보내 선택한 라이브러리가 제공 한 응답을 읽습니다.
여기에 이 있습니다. C를 시작 했으므로 해결할 수있을 것입니다.
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
그러나 당신이 잘못된 일을 찾고 있기 때문에 libcurl에서의 C++ 래퍼는 다음 curlpp
#include <curlpp/curlpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namespace curlpp::options;
int main(int, char **)
{
try
{
// That's all that is needed to do cleanup of used resources
curlpp::Cleanup myCleanup;
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}
catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}
return 0;
}
귀하의 검색이 작동하지 않습니다를 사용합니다 그래서 만약 당신이 C++를 태그. 파싱하지 않고 웹 페이지를 가져 오려면 HTTP 클라이언트 라이브러리가 필요합니다. "html"을 찾지 마십시오. "html"을 구문 분석하고 싶지 않으므로 검색과 관련이 없습니다. –