php脚本记录POST的原始数据 [英] php script to log the raw data of POST

查看:260
本文介绍了php脚本记录POST的原始数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTTP POST向我的服务器发送数据.但是在服务器中,我没有收到数据.而且我不知道如何在客户端检查数据(或调试脚本).但是在客户端,我正在获取HTTP 200,这意味着已发送数据.我也可以看到连接和数据发送成功.但是,登录服务器不包含数据(仅包含字节数).

I am sending data using HTTP POST to my server. But in the server, I am not receiving the data. And somehow I don't have any way to check the data (or debug script) on client side. But on client side I am getting HTTP 200, means data is sent. Also I can see the connection and data sending was successful. However log in the server doesn't contain the data (only the number of bytes).

如何记录发送到服务器的原始POST数据?

How can I log the raw POST data that was sent to the server?

仅供参考,此处的客户端是功能非常有限的嵌入式设备.所以,这是问题.因此,我无法检查"print_r"或"echo"

FYI, here client is an embedded device with very limited capability. SO, is this problem. So, I can not check "print_r" or "echo"

推荐答案

您可以通过以下方式查看内联发布数据的内容(不适用于生产):

You can see the content of post data inline (not for production) with:

print_r($_POST);

或者如果您想查看POST,GET和COOKIE数据:

Or if you want to see POST, GET and COOKIE data:

print_r($_REQUEST);

如果您需要登录,由于客户端非常有限,请尝试将POST数据输出到文件:

If you need to log, since the client is very limited - try outputting the POST data to a file:

file_put_contents("post.log", print_r($_POST, true));

这篇关于php脚本记录POST的原始数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆