当前位置: 首页 > news >正文

黑客网站谷歌推广哪家好

黑客网站,谷歌推广哪家好,c 网站设计,wordpress登陆帐号报错404很简单的使用libcurl来操作http与服务器来通讯,包含http与https,对外只开放 #include "request.h" #include "response.h" #include "url.h" 三个头文件,简单易用,使用的实例如下: vo…

很简单的使用libcurl来操作http与服务器来通讯,包含http与https,对外只开放

#include "request.h"
#include "response.h"
#include "url.h"

三个头文件,简单易用,使用的实例如下:
void test_get()
{
    Request request("http://httpbin.org/ip");
    Response response = request.Perform();

    printf("---------------------------------------------\n");
    printf("%s\n", to_string(response.status()));
    printf("---------------------------------------------\n");
    if (response.status() == Status::SUCCESS
        && response.http_status_code() == http::StatusCode::HTTP_200_OK)   // equal to response.ok()
    {
        // Header
        printf("------ Headers -------------------------------\n");
        auto& headers = response.headers();
        for (auto& header : headers) {
            printf("%s: %s\n", header.first.c_str(), header.second.c_str());
        }
        // Data
        printf("------ Body ----------------------------------\n");
        printf("%s\n", response.data().c_str());
        printf("---------------------------------------------\n");
    }
    printf("\n\n");
}

void test_url() 
{
    Url url("https://api.icrystal.top/util/random");
    url.SetParam("min", "1");
    url.SetParam("max", "100");
    url.SetParam("count", "20");
    printf("GET: %s\n", url.ToString().c_str());

    Request request(url.ToString());
    request.set_verify_ssl(false);
    auto response = request.Perform();

    if (response.ok()) {
        // Header
        printf("------ Headers -------------------------------\n");
        for (auto& header : response.headers()) {
            printf("%s: %s\n", header.first.c_str(), header.second.c_str());
        }
        // Data
        printf("------ Body ----------------------------------\n");
        printf("%s\n", response.data().c_str());
        printf("---------------------------------------------\n");
    }
    else {
        printf("Request Error: %s %s\n", to_string(response.status()), http::to_string(response.http_status_code()));
    }
}
下载地址:

https://download.csdn.net/download/u011269801/88874623

http://www.hrbkazy.com/news/15.html

相关文章:

  • 新疆做网站哪家公司好天津seo排名公司
  • 响应式网站实例一个新公众号怎么吸粉
  • 网站制作多少钱一年2023b站推广大全
  • 展厅设计的要点有哪些济南seo排名优化推广
  • 虚拟机可以做多个网站整站优化快速排名
  • 网站建设续费的回访话术全球搜效果怎么样
  • 餐厅网站设计模板下载百度关键词排名代发
  • c2c代表平台有哪些seo培训多少钱
  • 中国十大咨询公司深圳最好的外贸seo培训
  • 做网站要用什么计算机语言百度学术官网论文查重免费
  • 遵义哪里做网站网店代运营公司靠谱吗