直接上代码:
代码如下:
/*返回一个302地址*/
function curl_post_302($url,$vars) {$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,CURLOPT_FOLLOWLOCATION,1); // 302 redirect
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
$data = curl_exec($ch);
$Headers = curl_getinfo($ch);
curl_close($ch);
if ($data != $Headers)
return $Headers["url"];
else
return false;}
原文链接:https://www.f2er.com/php/24730.htmlfunction curl_post_302($url,$vars) {$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,CURLOPT_FOLLOWLOCATION,1); // 302 redirect
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
$data = curl_exec($ch);
$Headers = curl_getinfo($ch);
curl_close($ch);
if ($data != $Headers)
return $Headers["url"];
else
return false;}