Hi i am relative new to php,
on my own apache server (localhost), i use one .php script to 'post' data to another .php script, which is also on my server. I cannot receive the posted data.
The code on the sending page is:
# $req = "&One=Ena&Two=Dyo&Three=Tria";
# $req = urlencode($req);
# $header = "POST /main/php/Receive.php HTTP/1.1\r\n";
# $header .= "Host: localhost\r\n";
# $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
# $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
# $header .= $req;
#
#
# $fp = fsockopen ('localhost', 8000, $errno, $errstr,2);
# if (!$fp) { $message ="// HTTP connection ERROR!"; echo $message; exit;}
# else {
# fputs ($fp, $header);
# echo "Success on fputs!<br/>";
#
# while (!feof($fp) )
# {
# $res[$i] = fgets($fp,1024);
# echo "RESULTs :".count($res)."<br/>";
# echo 'Res['.$i.'] ='.$res[$i]."<br/>";
# $i++;
# }
# }
# fclose($fp);
while the code on the receiving script is:
# $result = 'NULL';
#
# foreach( $_POST as $key => $value ) // also tried $_REQUEST
# { $result .= $value; }
# ///// then i write the $result on a MYSQL table
On each execution of the sending script, the receiving script is triggered. I know this, because a new insertion of $result is entered in mysql after the sending script is executed, but it is allways an emty string.
I checked the $_POST with other ways also, but it still shows empty.
Please advise what am i doing wrong. Any help appreciated.