Link to home
Start Free TrialLog in
Avatar of andys79
andys79

asked on

Delphi -> POST -> PHP

Hello,

I wrote an delphi application, that send via NMHTTP
data to the php-script (internet).

The PHP-Script should use this variables, for example
i send an string "test=abc"  the script should output
abc  ( echo $test)

But the variable is empty. When I send it via ?test=abc  the output is right. The POST via Delphi's NMHTTP don't work as I want ...

can anyone help me?

Thanx
Andy
Avatar of us111
us111
Flag of Luxembourg image

first, in a simple HTML form, does the PHP post method work ??
I don't know NMHTTP, but I think it should work if NMHTTP support the post method
Avatar of andys79
andys79

ASKER

Hi,

for example to show my problem:

test1.html
-----------
<form name="test" method="POST" action="test2.php">
<input type="hidden" name="helloworld" value="yes">
<input type="submit">
</form>

test2.php
---------
<?php
echo "Skript running ...";
echo $helloworld;
// or: echo $HTTP_POST_VARS["helloworld"];
?>


=> OUTPUT: Skript running ...yes
-------------

the output is correct.
But when I use this script (test2.php) in Delphi via NMHTTP

     NMHTTP1.Post(Edit1.Text, 'helloword=yes');

then I get this:

=> OUTPUT: Skript running ...

(Edit1.Text is the URL of the php-internet-script)

I cannot access to the POST-Variable helloworld, or should I define the POST-Variables in another way in delphi?

Thanx

Andy

I believe that there's a problem with
NMHTTP1.Post(Edit1.Text, 'helloword=yes');

try
NMHTTP1.Get(Edit1.Text, 'helloword=yes');
if it exists :)

I don't know delphi
Avatar of andys79

ASKER

It doesn't work ...
(Too much parameter) ;-((
ASKER CERTIFIED SOLUTION
Avatar of Eddie Shipman
Eddie Shipman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andys79

ASKER

Can a webserver accept posts from another application or is there a security mechanism?
Avatar of andys79

ASKER

Can a webserver accept posts from another application or is there a security mechanism?
Sorry, I was in holiday ..
Yes, as far as it's concerned, it is just another browser.

The example I show above works. I wrote a PHP program
just as you did and used the Delphi source above to
retrieve the value from the server.