http://111.3.10.10:9123/yanfabu/getLckData1.php?type=update_wgjy_yfb&data={%22f_lckh%22:%222212052500%22,%22f_qty%22:36,%22f_hgqty%22:36,%22f_jyqty%22:3}
成都創(chuàng)新互聯(lián)主營(yíng)謝家集網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,手機(jī)APP定制開(kāi)發(fā),謝家集h5小程序開(kāi)發(fā)搭建,謝家集網(wǎng)站營(yíng)銷(xiāo)推廣歡迎謝家集等地區(qū)企業(yè)咨詢(xún)void CCM3600App::SendResERP(CString csResult)
{char Data[1024];
WSADATA wData;
::WSAStartup(MAKEWORD(2, 2), &wData);
wchar_t* msg;
DWORD dwNum;
SOCKET Client_Sock = socket(AF_INET, 1, 0);
struct sockaddr_in sin = {0 };
int Ret = 0;
int AddrLen = 0;
HANDLE hThread = 0;
WideCharToMultiByte(CP_ACP, 0, csResult, -1, Data, 1024, NULL, NULL);
//拼接請(qǐng)求信息 //POST
char send_str[2048] = {NULL };
strcat(send_str, "GET ");
strcat(send_str, "/yanfabu/getLckData1.php?");
//strcat(send_str, "type=update_wgjy_yfb&data={%22f_lckh%22:%222212052500%22,%22f_qty%22:36,%22f_hgqty%22:36,%22f_jyqty%22:3}");
strcat(send_str, "type=update_wgjy_yfb&data=");
strcat(send_str, Data);
strcat(send_str, " HTTP/1.1\r\n");
strcat(send_str, "Connection:Keep-Alive\r\n");
//strcat(send_str, "Content-Type:application/json\r\n");
strcat(send_str, "Content-Type:text/html;charset=utf-8\r\n");
strcat(send_str, "Accept-Encoding:gzip, deflate\r\n");
strcat(send_str, "Accept-Language:zh-CN,en,*\r\n");
strcat(send_str, "host:");
//strcat(send_str, "192.168.1.100");
strcat(send_str, "111.3.10.10");
strcat(send_str, "\r\n");
strcat(send_str, "User-Agent:Mozilla/5.0\r\n\r\n");
char addIp[256] = {0 };
//theApp.GetIpByDomainName("192.168.1.100", addIp);
theApp.GetIpByDomainName("111.3.10.10", addIp);
sin.sin_addr.s_addr = inet_addr(addIp);
sin.sin_port = htons(9123);;
sin.sin_family = AF_INET;
char bufRecv[3069] = {0 };
int errNo = 0;
errNo = connect(Client_Sock, (sockaddr*)&sin, sizeof(sin));
char cs_str[1024] = {NULL };
char recv_str[8192] = {NULL };
if (errNo == 0)
{//如果發(fā)送成功,則返回發(fā)送成功的字節(jié)數(shù);
if (send(Client_Sock, send_str, strlen(send_str), 0) >0)
{ m_SendOKorNO = 1;
}
else
{ m_SendOKorNO = 0;
}
//如果接受成功,則返回接受的字節(jié)數(shù);
if (recv(Client_Sock, cs_str, 3069, 0) >0)
{}
}
else
{errNo = WSAGetLastError();
}
//接收正常拼接字符串
strcat(recv_str, cs_str);
memset(cs_str, 0, sizeof(cs_str));
//只獲取 報(bào)頭信息后面的 返回值
char* re_msg = strstr(recv_str, "\r\n\r\n");
//轉(zhuǎn)換字符串
dwNum = MultiByteToWideChar(CP_UTF8, 0, re_msg, -1, NULL, 0);
msg = new wchar_t[dwNum];
MultiByteToWideChar(CP_UTF8, 0, re_msg, -1, msg, dwNum);
//char*和CString的轉(zhuǎn)換
msg[dwNum] = '\0';
CString str;
str.Append(msg);
g_csErpRecData = str;
//關(guān)閉socket
closesocket(Client_Sock);
WSACleanup();
//返回接收到的響應(yīng)字符串
return;
}
你是否還在尋找穩(wěn)定的海外服務(wù)器提供商?創(chuàng)新互聯(lián)www.cdcxhl.cn海外機(jī)房具備T級(jí)流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確流量調(diào)度確保服務(wù)器高可用性,企業(yè)級(jí)服務(wù)器適合批量采購(gòu),新人活動(dòng)首月15元起,快前往官網(wǎng)查看詳情吧