开发者

Error 413 when using curl to post

I get error 413 every time i try to post data with php script using curl. I can "get" web pages,but when i use "post" the script dies with

does not allow request data with POST requests, or the amount of data provided

in the request exceeds the capacity limit.

I have a py script,which works. Here is an example code that doesn't work:





 $q=curl_init(POSTURL);

 curl_setopt($q,CURLOPT_POST,true);
 curl_setopt($q,CURLOPT_RETURNTRANSFER,true);


 $post=array("q"=>2);
   $ss=curl_setopt($q,CURLOPT_URL,"http://localhost");
        curl_setopt($q,CURL_POSTFIELDS,$post);
 $f=curl开发者_高级运维_exec($q);
 curl_close($q);
        echo $f." is error"; 

I don't know if the problem is with apache,with my script or something else.


Has the webserver been configured to allow POSTs? On Apache that would be most likely be a <Limit> directive. Or has the LimitRequestBody been set to 0 (or at least a value smaller than your post is turning out to be)?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜