Php 代码在postman中工作,但在脚本中不工作-最多可执行47(20)个重定向
我在postman上创建并测试了一个post请求,它返回了正确的页面,但当我将此代码放入PHP中时,它不起作用,我得到了错误:Php 代码在postman中工作,但在脚本中不工作-最多可执行47(20)个重定向,php,curl,postman,Php,Curl,Postman,我在postman上创建并测试了一个post请求,它返回了正确的页面,但当我将此代码放入PHP中时,它不起作用,我得到了错误: 47随后最多(10)次重定向 $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://xxxxx.com/login/", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "",
47随后最多(10)次重定向
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://xxxxx.com/login/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"email=xxxx.xxxx%40mail.com&password=xxxxu&url=",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/x-www-form-urlencoded",
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
有什么帮助吗 如果您使用的是自签名证书,则应使用curl禁用ssl检查
curl\u setopt($ch,CURLOPT\u SSL\u VERIFYPEER,false)
可能是因为表单数据中的url参数为空?只是猜测而已。不是那样。。。。