可以接收到所有的POST数据之前,一个PHP脚本开始?有的、脚本、数据、POST

2023-09-03 20:47:37 作者:负势

我的Apache下运行PHP和我想发送的POST数据的缓慢滴入,以作为POST数据到达,将信息写入到数据库中的网页。我是从一个.NET应用程序中使用发送数据的WebRequest ,我已经设置 SendChunked 为true。

I'm running PHP under Apache and I'd like to send a slow trickle of POST data to the page that will write messages into a database as the POST data arrives. I'm sending the data from a .NET app using WebRequest and I've set SendChunked to true.

不幸的是,它看起来像PHP脚本没有开始执行,直到所有的POST数据已经到来。我看着在Apache日志,我看到,请求马上开始,但回声的strftime(...)在PHP脚本报表显示,它没有运行直到收到所有的POST数据之后。

Unfortunately, it looks like the PHP script doesn't start executing until all the POST data has arrived. I looked in the apache log, and I see that the request starts right away, but echo strftime(...) statements in the PHP script show that it isn't running until after all the POST data was received.

有没有办法告诉PHP马上开始?我试着在php.ini文件中设置 always_populate_raw_post_data =关闭,但是这并没有什么差别。我的要求有应用程序/八位字节流和内容类型 $ HTTP_RAW_POST_DATA 仍是充满了所有的POST数据

Is there any way to tell PHP to start right away? I tried setting always_populate_raw_post_data = Off in the PHP.ini file, but that didn't make any difference. My request has a content type of application/octet-stream, and $HTTP_RAW_POST_DATA is still filled with all the POST data.

推荐答案

您可以使用的 HTTP PUT 的方法,但不能与POST。

You can do this using the HTTP PUT method, but not with POST.

在客户端使用PUT动词的数据流中的PHP。它可以通过 PHP访问:: //输入通过字节流字节,因为它是从客户端发送。

When the client uses the PUT verb the data is streamed in to PHP. It can be accessed through the php:://input stream byte by byte as it is sent from the client.