- function GetIp(Url: PChar): string; //向網頁提交GET信息函數
- var
- ErrCode: string;
- hInternets, hInternetFiles: HINTERNET;
- dwOut: DWORD;
- lpBuffer: array[0..4096] of Char;
- begin
- ErrCode := 'heihei';
- Result := ErrCode;
- hInternets := InternetOpen('Huai_Huai', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
- if hInternets = nil then
- begin
- Result := ErrCode;
- Exit;
- end;
- hInternetFiles := InternetOpenUrl(hInternets, url, nil, 0, INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_RELOAD or INTERNET_FLAG_TRANSFER_BINARY, 0);
- if hInternetFiles = nil then
- begin
- InternetCloseHandle(hInternets);
- Result := ErrCode;
- Exit;
- end;
- dwOut := 0;
- Fillchar(lpBuffer, sizeof(lpBuffer), 0);
- if InternetReadFile(hInternetFiles, @lpBuffer, 4096, dwOut) then
- Result := lpBuffer
- else
- Result := ErrCode;
- InternetCloseHandle(hInternets);
- end;
delphi 使用API返回網頁信息
uses WinInet
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.