CPR GitHub Address HTTPS://GITHUB.COM/WHOSHUU/CPR
Simple example: cpr_http_request.cpp
#include <iostream>#include<cpr/cpr.h>intMain () {std::stringRequestaddress ("https://api.eyekey.com/face/Check/checking"); STD::stringRequestparams ("app_id=f89ae61fd63d4a63842277e9144a6bd2&app_key=af1cd33549c54b27ae24aeb041865da2&url=http%3a%2f% 2fpicview01.baomihua.com%2fphotos%2f20120713%2fm_14_634778197959062500_40614445.jpg"); Std::cout<<"GET Sample:"<<Std::endl; ConstCpr::response &responseforget = Cpr::get (Cpr::url (Requestaddress.append ("?"+( requestparams))); Std::cout<<'\ t'<< Responseforget.status_code <<Std::endl; Std::cout<<'\ t'<< Responseforget.text <<Std::endl; Std::cout<<"POST Sample:"<<Std::endl; Cpr::multipart multipart{{"app_id","f89ae61fd63d4a63842277e9144a6bd2"}, {"App_key","af1cd33549c54b27ae24aeb041865da2"}, {"URL","https://gss1.bdstatic.com/9vo3dSag_xI4khGkpoWK1HF6hhy/baike/w%3D268%3Bg%3D0/sign= 18bb0cc2dd1373f0f53f68999c342cc6/caef76094b36acafe725024570d98d1000e99c46.jpg"} }; ConstCpr::response &responseforpost =CPR::P ost (Cpr::url (requestaddress), multipart); Std::cout<<'\ t'<< Responseforpost.status_code <<Std::endl; Std::cout<<'\ t'<< Responseforpost.text <<Std::endl; Std::system ("Pause"); return 0;}
Initiating an HTTP request using Libcurl's packaging library CPR