0
기본 Delphi 2010 기능 만 갖춘 Delphi를 사용하여 웹 POST를 수행하는 방법에 대해 순수한 델파이 스 니펫을 가지고있는 사람이 있습니까?Indy 또는 다른 타사 모듈을 사용하지 않고 Delphi POST 수행
기본 Delphi 2010 기능 만 갖춘 Delphi를 사용하여 웹 POST를 수행하는 방법에 대해 순수한 델파이 스 니펫을 가지고있는 사람이 있습니까?Indy 또는 다른 타사 모듈을 사용하지 않고 Delphi POST 수행
const chunksize = 512; //<--neu
procedure TForm1.Button1Click(Sender: TObject);
var
content,data : string;
accept : string;
buffer :Pchar;
hSession,hConnect,hRequest : HINTERNET;
bytesread:cardinal; //<--edit
name,passwort :string;
begin
GetMem(buffer, chunksize); //<--neu
Name:= 'Loginname';
Passwort :='Passwort';
content := 'Content-Type: application/x-www-form-urlencoded';
data := 'v=2&universe=uni34.ogame.de&login='+Name+'&pass='+Passwort+'&button.x=22&button.y=5';
accept :='*/*';
hSession := InternetOpen('MyAgent',INTERNET_OPEN_TYPE_PRECONFIG,nil, nil,0);
hConnect := InternetConnect(hSession,'uni34.ogame.de', //<--edit
80,nil,nil,INTERNET_SERVICE_HTTP, 0, 1);
hRequest := HttpOpenRequest(hconnect,
'POST',
'game/reg/login2.php',
nil,
nil,
plpstr(accept),
0,1);
httpSendrequest(hRequest,pchar(content),length(content),pchar(data),length(data));
//-->neu+edit<--//
memo1.lines.clear;
repeat
FillMemory(buffer,chunksize,0); //0 wegen null-terminiertem string
InternetReadFile(hRequest,
buffer,
chunksize-1,
bytesread);
memo1.Lines.Text:=memo1.lines.text+Trim(string(buffer));
until bytesread = 0;
FreeMem(buffer);
//-->bis hier<--//
end;
고맙습니다! 이것을 출발점으로 사용하겠습니다 :) –
WinInet이는 그 내장 델파이 모듈? –
아니요. 그것은 [Windows의 일부] (http://msdn.microsoft.com/en-us/library/windows/desktop/aa383630(v=vs.85) .aspx)입니다. – TLama