Link to home
Start Free TrialLog in
Avatar of Narusegawa
Narusegawa

asked on

Web Form POST

I'm trying to POST some data to a Form on the web. Actually to a PHPScript that accepts the POST method.

The form is at http://www.domain.com/form.php

I need to pass along variables in the form of POSTing. Not GET. I've seen scripts around that say to basically put the values I want posting onto the URL and call it that way. I will be posting from a memo box and so that wouldn't work due to line breaks. Also how would one connect to the webserver to start sending it variables in the POST format. Thanks in advance.
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 Narusegawa
Narusegawa

ASKER

That works to my PHP Script I've got, just displays values posted to it.

I'm not sure if it is retaining the line breaks of the memo box once it's at the form server though. Basically I'm writing a Live Journal client (Quick n Dirty) in Delphi. Any suggestion on how I can check if the line breaks are still in the value once it gets to the destination form server?

Thanks
What I would do is replace the linebreaks in my string that I post to
an HTML <br> then use the PHP command str_replace to replace
them with a line break.
It keeps line breaks anyway as I found out.

Got a quick question relating futher to this topic.

If I put an idTCPClient component on my form. Then put an idHTTP on the form too, will the idHTTP use idTCPClient to connect to the server passed to it.

Example:

onShow Event:
  idTCPClient.Host := 'www.livejournal.com';
  idTCPClient.Port := 80;
  idTCPClient.Connect;

onClick Event:
  idHTTP.Post('http://www.livejournal.com/interface/flat', Params, aStream);

Would the OnClick event function any faster with a connection already made by idTCPClient? I know idHTTP.Post can post by itself without a idTCPClient on the form, but however I may be sending 10's upon 10's of POST's within a few minutes space and so I was thinking that if idTCPClient can maintain a persistant connection that idHTTP could use then it'd be a touch faster because it doesn't have to re-negotiate the network connection each time I call the POST function.
No, http is stateless and makes a connection each time a put/get/head or any other command is made.
It won't be any quicker and it won't use the same connection that tdpclient has open as it opens one
for itself.