0

I have two PHP scripts. One posts a message "Hello" while the other receives it. Currently, the second PHP script receives a _POST['message'] but the contents of that message is empty!

Script One:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
 'message' => 'Hello'
));
$result = curl_exec($ch);
if($result) {
echo("Successful post");
}
curl_close($ch);

Script Two:

if($_POST['message']) {
  echo("received post message");
  echo ("message:" . $POST['message']);

Currently script Two prints "received post messagemessage:"

I'm completely flummoxed - from looking at this post, it seems my syntax is correct....

4

1 回答 1

1

脚本 2 语法错误,必须是$_POST.

if($_POST['message']) {
  echo("received post message");
  echo ("message:" . $_POST['message']);
于 2013-08-11T13:27:08.770 回答