Best Answer escafandra , 12 April 2022 - 01:55 PM
Prueba de esta manera:
delphi
uses Wininet; function InternetReadWeb(URL: String): String; var hNet: pointer; hUrl: pointer ; Buffer: array [0..255] of char; BytesRead: DWORD; NoError: boolean; Ind: integer; begin BytesRead:= 0; Result:= ''; if InternetAttemptConnect(0) <> ERROR_SUCCESS then exit; hNet:= InternetOpen('agent', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if hNet <> nil then begin hUrl:= InternetOpenUrl(hNet, PCHAR(URL), nil, 0, INTERNET_FLAG_RELOAD, 0); if hUrl <> nil then begin // Lee la pagina web... ind:=0; repeat NoError:= InternetReadFile(hUrl, @Buffer[0], sizeof(Buffer)-1, BytesRead); if NoError and (BytesRead = 0) then break; Buffer[BytesRead]:= #0; Result:= Result + String(Buffer); inc(ind, BytesRead); until NoError and (BytesRead=0); InternetCloseHandle(hUrl); end; InternetCloseHandle(hNet); end; end; procedure TForm1.Button3Click(Sender: TObject); begin Memo1.Text:= InternetReadWeb('https://developers.google.com/search/docs/advanced/security/https?hl=es'); end;
Saludos. Go to the full post