0

我在 php 上发送发布请求,发布后我想显示感谢信息,我的邮政编码是:

<?php
    $error = '';
    $FullName = $_POST['FullName'];
    $Email = $_POST['Email'];
    $Password = $_POST['Password'];
    $Content = $FullName." ".$Email." ".$Password;
    $server= '192.168.1.13:3033';
    $path = '/user/registration';

    $headers= "POST $path HTTP/1.0\r\nContent-type: text/html\r\nHost: $server\r\nContent-length: $Content\r\n\r\n";
    $fp = fsockopen($server, $port);

    if (!$fp) return false;

    fputs($fp, $headers);
    fputs($fp, $Content);

    $ret = "";

    while (!feof($fp)) {
        $ret.= fgets($fp, 1024);
    }

    fclose($fp);
    print $ret;
?>

我的帖子请求正在运行,但我不知道如何在同一页面上显示消息任何帮助将不胜感激

4

2 回答 2

0

我不确定您要在这里做什么,但是您可以尝试以下操作并告诉我

<?php

$port = 3033;
$error = '';
$FullName = $_POST['FullName'];
$Email = $_POST['Email'];
$Password = $_POST['Password'];
$Content = $FullName." ".$Email." ".$Password;
$server= '192.168.1.13';
$path = '/user/registration';

$headers = "POST $path HTTP/1.0\r\nContent-type: text/html\r\nHost: $server\r\nContent-length: $Content\r\n\r\n";
$data = $headers . $Content;
$fp = fsockopen($server, $port);

if (!$fp)
{ 
    return false;
}
else
{

    fputs($fp, $data);

    $ret = "";

    while (!feof($fp)) {
        $ret.= fgets($fp, 1024);
    }

    fclose($fp);

    print("Thank you for using our service.\r\n\r\n".$ret);        
}


?>
于 2013-06-19T13:16:00.187 回答
-1

这里的echo功能可能很有趣。

于 2013-06-19T12:56:56.577 回答