Page 1 of 1

sending POST request

Posted: Thu Dec 02, 2004 7:41 am
by nosti
PLEASE HELP ME! :?:

i am trying to :

$ReqBody = "mytext=" . urlencode("hello world");
Header("POST /getmsg.php HTTP/1.1");
Header("Content-Type: application/x-www-form-urlencoded; charset=utf-8");
Header("Content-Length: ".strlen($ReqBody));
Header("");
Header($ReqBody);

and i also have the getmsg.php script which prints out the POST variable $_POST['mytext']

when i try to send the data with a simple html <FORM> and method="post" i have no problems
BUT

with the script above it doesn't work

PLEASE PLEASE PLEASE HELP ME !!!

How do i send POST data , even not using Header

Posted: Thu Dec 02, 2004 8:02 am
by CoderGoblin
Use HTML Forms.

Code: Select all

<form name="xyz" action="action_script/html" method="POST">

Re: sending POST request

Posted: Thu Dec 02, 2004 8:50 am
by hedge
nosti wrote:PLEASE HELP ME! :?:

i am trying to :

$ReqBody = "mytext=" . urlencode("hello world");
Header("POST /getmsg.php HTTP/1.1");
Header("Content-Type: application/x-www-form-urlencoded; charset=utf-8");
Header("Content-Length: ".strlen($ReqBody));
Header("");
Header($ReqBody);

and i also have the getmsg.php script which prints out the POST variable $_POST['mytext']


when i try to send the data with a simple html <FORM> and method="post" i have no problems
BUT

with the script above it doesn't work

PLEASE PLEASE PLEASE HELP ME !!!

How do i send POST data , even not using Header
You can't do it using header. you have to use curl, snoopy or roll-yer-own with fsockopen etc.