doudiaozhi6658 2015-10-14 14:10
浏览 50

PHP - 收听POST请求

EDITED QUESTION: I want to simulate two different applications. On the first (script X) a form can be submitted and gets handled by itself. He also is POSTing data to a second application (script Y) via REST.

Currently script Y is nothing more then:

<?php
if(isset($_POST)) {
 deliver_response(200, "success", $_POST);
}

function deliver_response($status, $status_message, $data) {
 header("HTTP/1.1 $status $status_message");
 $response['status'] = $status;
 $response['status_message'] = $status_message;
 $response['data'] = $data;

$json_response = json_encode($response);
 echo $json_response;
}
?>

So, when I submit script X, it is POSTing some data to script Y via REST, and above shows how script Y handles the POST request from script X. The echo is being displayed on the screen of script X, but I want to have a second screen with script Y where this echo is being displayed automatically at the moment it receives the POST request from script X.

I hope I made my point clear. Is this somehow possible that script Y just receives the POST request (maybe still sending 200 succes back), but also displays the data it received on it's own screen? If yes, could you give me a hint?

And no, I don't want for script Y to check every few seconds with a GET request if there was submitted some new data at script X.

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • doujing6436 2015-10-14 14:29
    关注

    To refresh the page you could use ajax. http://www.w3schools.com/ajax/default.asp

    You could also do a refresh on page Y with PHP

    header("Refresh:0");
    
    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向