Added topic I'm tired why i'm tired ? ho, let me think.. maybe because people ask questions without providing deatails or maybe because people ask questions that can easily get answered using a quick Search (top right corner on every page) or google or maybe because Added topic The Function StringToInteger() has been made in a hurry long...
올바른 매개변수(또는 모든 매개변수)를 사용해야 한다고 생각합니다.
감사합니다!
bool HttpSendRequestW(int hRequest, 문자열 lpszHeaders, int dwHeadersLength, char &lpOptional[], int dwOptionalLength);
#define INTERNET_FLAG_RELOAD 0x80000000
#define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000
#define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100
int hSession_IE 유형;
int hSession_Direct;
int Internet_Open_Type_Preconfig = 0;
int Internet_Open_Type_Direct = 1;
int hSession(bool 직접)
{
string InternetAgent = "Mozilla/4.0(호환됨, MSIE 6.0, Windows NT 5.1, Q312461)";
if (직접)
{
if (hSession_Direct == 0)
{
hSession_Direct = InternetOpenW(InternetAgent, Internet_Open_Type_Direct, "0", "0", 0);
}
반환(hSession_Direct);
}
또 다른
{
if (hSession_IEType == 0)
{
hSession_IEType = InternetOpenW(InternetAgent, Internet_Open_Type_Preconfig, "0", "0", 0);
}
반환(hSession_IEType);
}
}
무효 httpPost(문자열 strUrl, int 포트, 문자열 idxfile = "index.php"){
string headers = "콘텐츠 유형: application/x-www-form-urlencoded";
문자열 데이터 = "a=123";
문자 데이터[];
StringToCharArray(데이터, 데이터);
정수 HttpOpen = hSession(거짓);
int HttpConnect = InternetConnectW(HttpOpen, strUrl, 포트, "", "", 3, 0, 0);
int HttpRequest = HttpOpenRequestW(HttpConnect, "POST", idxfile , "", "", NULL, 0, 0);
부울 결과 = HttpSendRequestW(HttpRequest, 헤더, StringLen(헤더), 데이터, StringLen(데이터));
uchar 채널[100]; 문자열 toStr=""; 정수 dwBytes, h=-1;
동안(InternetReadFile(HttpRequest, ch, 100, dwBytes))
{
if (dwBytes<=0) 중단; toStr=toStr+CharArrayToString(ch, 0, dwBytes);
}
정수 오류 = GetLastError();
if(err>0)Print("마지막 MSDN 오류 =: ",err);
정수 읽기[1];
Print("POST 결과입니다: ", result);
인쇄(toStr);
인터넷 닫기 핸들(HttpOpen);
인터넷 닫기 핸들(HttpRequest);
}
httpPost("www.test.com",80);
해결할 수 있는 곳입니다. get 및 post 요청을 할 수 있지만 서버가 빈 파일을 수신하기 때문입니다. jsonfile 또는 문자열을 보내는 방법을 찾을 수 없습니다