Autor Beitrag
chukalv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 15.05.06 09:46 
Don`t get it what I`m doing wrong. The post method doesn`t work for me...

The php source:
ausblenden Quelltext
1:
2:
3:
<?
echo $_POST['test'];
?>


The delphi source:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var
input, output : Tstringstream;
begin
input := TStringstream.Create('');
output := TStringstream.Create('');
try
input.WriteString('test=helloworld');
Idhttp1.Request.ContentType := 'application/x-www-form-urlencoded';
Idhttp1.Post('http://localhost/testi/aha.php',input,output);
Memo1.lines.LoadFromStream(output);
finally
input.free;
output.free;
end;


As I understood. The output should be ''helloworld', but it allways gives out a blank page.

P.S. In every example that I`v looked there is a URLENcode function mentioned. I`m using Delphi 6 and I don`t have such a built-in funcion...As I know, the urlenocde is neede if there are some other characters like space...
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 15.05.06 10:16 
So you wont to send parameters through a PHP script?
Suche bei Delphi-Treff PER POST DATEN AN SCRIPTS SENDEN (sry in german)
chukalv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44



BeitragVerfasst: Mo 15.05.06 10:57 
Thanks. This this one worked for me. Just I don`t understand how to change it for file uploading.. Just sending a variable 'file=C:\test.txt' doesn`t work...
Or am I doing something wrong in the php?
ausblenden Quelltext
1:
2:
$file = $_POST['file'];
move_uploaded_file($file,'/upload/file.txt');


?