Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am trying to make a POST request to a URL using Curl but getting this error?

Tags:

curl

ERROR:

Request Entity Too Large The requested resource /check.php does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.

Whar could be the reason for this error? I think data size cannot be the reason and I know ./check.php accepts POST method. Is it like some security that is lmiting access?

regards, aqif

like image 689
Aqi Avatar asked Feb 23 '11 12:02

Aqi


2 Answers

If you are forced to make a POST request without parameters, you can set them to empty string or array. That solved this issue for me.

Either

curl_setopt($ch, CURLOPT_POSTFIELDS, '');

Or

curl_setopt($ch, CURLOPT_POSTFIELDS, array());

Be aware that the latter of these resets the content-type header implicitly.

like image 74
Klaus Avatar answered Oct 12 '22 13:10

Klaus


If you use curl_exec that you must set

curl_setopt($ch, CURLOPT_POSTFIELDS, **array()**);

If you'll miss that, so you'll have Error 413 Request Entity Too Large

like image 20
Anton Petrusha Avatar answered Oct 12 '22 15:10

Anton Petrusha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!