Autor Beitrag
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mi 20.11.02 13:52 
:? Ich versuche einen Request vie http.post zu versenden.


ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure MyPost();
var
  Input,Output:TStringStream;
begin
  Input := TStringStream.Create('');
  Output := TStringStream.Create('');
  try
    Input.WriteString('RC=@D&ACCT=root&URL=MeinPasswort');
    IdHTTP1.Post('http://192.168.165.1/cgi-bin/logi', Input, Output);
    memo1.Lines.LoadFromStream(Output);
  finally
    FreeAndNil(Input);
    FreeAndNil(Output);
  end;
end;


:idea: Das Problem ist nun, dass sich der bettr. Server dabei immer aufhängt.

:shock: Mache ich das gleiche mit einer html-Seite über den Internet-Explorer funktioniert es (HTML-Quellcode)
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
<HTML><BODY>
<FORM ACTION=http://192.168.165.1/cgi-bin/logi METHOD=POST>
<INPUT TYPE=HIDDEN NAME=RC VALUE="@D">
<INPUT TYPE=HIDDEN NAME=ACCT VALUE="root">
<INPUT TYPE=PASSWORD NAME=URL SIZE=9 MAXLENGTH=9>
<INPUT TYPE=SUBMIT VALUE="Log in"></FORM>
</BODY></HTML>


:( Ich vermute, dass ich etwas grundlegendes Falsch gemacht habe, aber ich komme nicht weiter. Dadurch, dass der "angepostete" Server meine Posts nicht verkraftet hängt mein Programm nach jedem Post.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 20.11.02 14:08 
und wenn du mal probierst das ganze per GET zu übertragen !!

da hängst du die ganzen variablen an die URL an !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Mi 20.11.02 14:17 
:!: Es muss POST sein, da der Server nur Post akzeptiert!

:x Es muss doch möglich sein irgendwie den gleichen Request abzusetzen wie es auch jeder Browser kann...
bas_gooijen
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Fr 22.11.02 20:37 
Versuche doch mal:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure MyPost(); 
var 
  Input:TStringList;
  Output:TStringStream; 
begin 
  Input := TStringList.Create; 
  Output := TStringStream.Create(''); 
  try 
    Input.Values['RC']:='@D';
    Input.Values['ACCT']:='root';
    Input.Values['URL']:='MeinPasswort';
    IdHTTP1.Post('http://192.168.165.1/cgi-bin/logi', Input, Output); 
    memo1.Lines.LoadFromStream(Output); 
  finally 
    FreeAndNil(Input); 
    FreeAndNil(Output); 
  end; 
end;
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Sa 23.11.02 11:35 
Auch das war nicht die Lösung. Mein Server akzeptiert auch diesen Request NICHT. Es klappt nach wie vor nur über den Browser...
ao
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 145

Win XP Prof.
D7 Ent.
BeitragVerfasst: Sa 23.11.02 12:05 
Hallo FriFra,

also bei mir funktioniert folgendes einwandfrei:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
var
  Request, Response: TStringStream;
begin
  Request := TStringStream.Create('');
  Request := TStringStream.Create('');

  FIdHttp.Request.ContentType := 'application/x-www-form-urlencoded';
  Request.WriteString('param1=' +UrlEncode(Trim(Param1.Text), True));
  Request.WriteString('¶m2=' +UrlEncode(Trim(Param2.Text), True));

  FIdHttp.Post('http://server.com/script.php', Request, Response);

  [...]


Vielleicht solltest du die Zeile mit dem ContenType bei dir ergänzen, das war mal das Problem bei mir, ist aber nur eine Vermutung!

Gruß
Andreas
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Sa 23.11.02 12:18 
:cry: Ich habe jetzt auch diesen Code ausprobiert... der Effekt ist der gleiche wie immer... der Server schmiert ab...
:evil: Es muss doch verdammt nochmal möglich sein exact so einen Request wie jeder beliebige Wald und Wiesen Webbrowser das auch kann abzusetzen.


:idea: P.S.: Auf den Server habe ich keinen Einfluss, da es ein embedet Webserver in einem Router ist.