问题描述
错误:
请求实体过大
请求的资源
/check.php
不允许POST请求数据请求,或者请求中提供的数据量超过容量限制。
Request Entity Too LargeThe requested resource/check.phpdoes not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
Whar可能是此错误的原因?我认为数据大小不能是原因,我知道./check.php接受POST方法。是否像一些安全性是忽略访问?
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?
问候,
aqif
regards,aqif
推荐答案
如果你真的想使用POST,那么你将按顺序使用CURLOPT_POST和CURLOPT_POSTFIELDS。
If you really want to use POST then you will have use CURLOPT_POST and CURLOPT_POSTFIELDS in this order. Having the result is handy for debugging as well.
<?php
$params=array(
'a'=>'text1',
'b'=>'text2'
);
$curl=curl_init();
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($curl);
print $result;
编辑:只是一个注释,如果你想发送没有参数的post, 。空字符串将折断curl。
edit: just a note, if you want to send no parameters with the post, use an empty array. empty string will break curl.
这篇关于我试图做一个POST请求URL使用Curl,但得到这个错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!