Autor Beitrag
lolol
Hält's aus hier
Beiträge: 5

Win2000
Delphi 6 Personal
BeitragVerfasst: Do 08.01.04 10:01 
Hi Forum!

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

ausblenden 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
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: 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. www.delphi-forum.de/viewtopic.php?t=9539

_________________
In the beginning was the word.
And the word was content-type: text/plain.
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: 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 Threadstarter
Hält's aus hier
Beiträge: 5

Win2000
Delphi 6 Personal
BeitragVerfasst: 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:

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


Gruß lolol
GruppeCN
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 322



BeitragVerfasst: So 01.10.06 17:16 
Vielleicht musst du noch den Content-Type richtig setzen?

ausblenden Delphi-Quelltext
1:
idhttp.Request.ContentType := 'application/x-www-form-urlencoded';					
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 06.10.06 18:13 
Der Thread ist doch völlig verjährt :--/

Zitat:
Verfasst am: Fr 09.01.04 01:10

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)