开发者

Check sent $_POST size

开发者 https://www.devze.com 2023-02-16 03:16 出处:网络
I\'m working on a Codeigniter application that can be accessed via Smartphones. The thing is that, at least for my carrier, the application won\'t load because of a \"server\" error (according to a 5.

I'm working on a Codeigniter application that can be accessed via Smartphones. The thing is that, at least for my carrier, the application won't load because of a "server" error (according to a 5.0 Blackberry Browser, POST data sent too big or GET data received too big, and a 6.0 Blackberry Browser, "The requested URL could not be retrieved - sorry, the file you're trying to upload or d开发者_如何学Pythonownload is too large"). The strange thing is that, when connected to a WiFi network, the site starts working again flawlessly.

I was wondering if I could mesure the PHP POST data sent and received in MB / KB, so I can slim it down as much as I can.

I don't know if this is a Codeigniter issue, or a carrier issue, or both, because the error appears only when I pass data via the URL. For example

example.com/codeigniter/main - OK example.com/codeigniter/main/post/131 - boom, dead.

Being "codeigniter/" the application, "main/" the controller, "post/" the method and 131 the value.

I'm using Codeigniter Reactor 2.0.1, BTW.


If you are trying to measure the size of the request, the $_SERVER superglobal has a property for this.

  $size = (int)$_SERVER['CONTENT_LENGTH'];

Submit your post to an endpoint with this code and echo it's value.

This will assign the value of the Content-length HTTP header to $size if the request was sent via the POST method.

0

精彩评论

暂无评论...
验证码 换一张
取 消