$ch = curl_init() ;
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_URL,$url) ;
curl_setopt($ch, CURLOPT_POST,count($fields)) ;
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string) ;
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch) ;
curl_close($ch) ;代码如上,在本地windows+apache测试无误,上传到服务器后就提示Object moved to here,这个是模拟一个登录,登录成功后跳转到另一个页面,Object moved to here的here的链接就是要跳转到的页面,服务器是*nix的,我估计是系统的问题,可是却找不出具体原因也不知道如何修改,望达人指教一二。
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_URL,$url) ;
curl_setopt($ch, CURLOPT_POST,count($fields)) ;
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string) ;
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch) ;
curl_close($ch) ;代码如上,在本地windows+apache测试无误,上传到服务器后就提示Object moved to here,这个是模拟一个登录,登录成功后跳转到另一个页面,Object moved to here的here的链接就是要跳转到的页面,服务器是*nix的,我估计是系统的问题,可是却找不出具体原因也不知道如何修改,望达人指教一二。
加一句代码http://curl.phptrack.com/forum/viewtopic.php?p=1294
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.360buy.com/product/549427.html');
curl_setopt($curl, CURLOPT_REFERER, 'http://www.360buy.com');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
print_r($result);
?>