Entwickler-Ecke

Internet / Netzwerk - idhttp.post an php script senden?!


lolol - Do 08.01.04 10:01
Titel: idhttp.post an php script senden?!
Hi Forum!

Ich hab folgenden Code genommen, um Variablen an ein PHP Script zu senden:


Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject); 
var 
  data: TIdMultiPartFormDataStream; 
begin 
  data := TIdMultiPartFormDataStream.Create; 
  try 
    { add the used parameters for the script } 
    data.AddFormField('param1''value1'); 
    data.AddFormField('param2''value2'); 
    data.AddFormField('param3''value3'); 

    { Call the Post method of TIdHTTP and read the result into TMemo } 
    Memo1.Lines.Text := IdHTTP1.Post('http://localhost/script.php', data); 
  finally 
    data.Free; 
  end
end;


Alles klappt soweit, nur das die Variablen im Script leer sind??

Mit einem normalen HTML-Formular klappt alles, auch die Variablen werden übergeben!!

Hat jemand eine Idee?

cu lolol


matze - Do 08.01.04 15:31

also soviel ich weiss, kannst du das result nocht mit
Memo1.Lines.Text := IdHTTP1.Post('http://localhost/script.php', data);
abfragen !!
das musst du anders machen !!

schau dir mal das tutorial zu den indys an !! also das indy http client demo. http://www.delphi-forum.de/viewtopic.php?t=9539


Anonymous - Do 08.01.04 18:39

du musst eventuell den formularnamen mitsenden....das musst du immer dann tun, wenn du an eine php seite postet wo der php interpreter eine hohe sicherheitsstufe eingestellt hat.


Gruß

ixtreme.de


lolol - Fr 09.01.04 01:10

ixtreme hat folgendes geschrieben:
du musst eventuell den formularnamen mitsenden....das musst du immer dann tun, wenn du an eine php seite postet wo der php interpreter eine hohe sicherheitsstufe eingestellt hat.


Gruß

ixtreme.de


und wie mache ich das?

auch einfach mit:


Delphi-Quelltext
1:
data.AddFormField('param1''value1');                    


Gruß lolol


GruppeCN - So 01.10.06 17:16

Vielleicht musst du noch den Content-Type richtig setzen?


Delphi-Quelltext
1:
idhttp.Request.ContentType := 'application/x-www-form-urlencoded';                    


GTA-Place - Fr 06.10.06 18:13

Der Thread ist doch völlig verjährt :--/

Zitat:
Verfasst am: Fr 09.01.04 01:10