手写C++代码实现POST传输数据


char *pHttpPost = "POST %s HTTP/1.1\r\n"
"Host: %s:%d\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: %d\r\n\r\n"
"%s";

char strHttpPost[1024] = { 0 };

sprintf(strHttpPost, pHttpPost, weburl.c_str(), ip.c_str(), port, data.length(), data.c_str());

//连接socket代码省略

// 发送
errNo = send(clientSocket, strHttpPost, strlen(strHttpPost), 0);


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM