发送POST请求
发送一个POST请求。此方法是同步的,请求发送过程中会阻塞直到发送完毕。支持TLS1.2安全协定,超时设为20秒。
接口调用
int hilens::POST(const std::string & url, const Json::Value & body, long & httpcode, std::string * response = NULL, POSTHeaders * headers = NULL)
参数说明
| 
        参数名  | 
      
        说明  | 
     
|---|---|
| 
        url  | 
      
        统一资源定位符。  | 
     
| 
        body  | 
      
        表示消息体内容的Json对象。  | 
     
| 
        httpcode  | 
      
        http请求返回值,如返回值为200则请求成功,返回值为404则不存在。  | 
     
| 
        response  | 
      
        响应,不填则为空。  | 
     
| 
        headers  | 
      
        请求头部,不填则忽略头部。 typedef std::vector<std::string> hilens::POSTHeaders POST请求的头部调用例如:headers.push_back(“Content-Type: application/json”);然后将其作为POST的参数传入。  | 
     
返回值
CURL返回值,0为成功。