curl模拟post时提示Object moved to here.

somebody-998 2012-05-06 12:55:50
$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的,我估计是系统的问题,可是却找不出具体原因也不知道如何修改,望达人指教一二。
...全文
826 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
萧易桥 2015-01-17
  • 打赏
  • 举报
回复
楼主请问解决了么。。。。我也是这个问题,,,,在sae上就不能用
码无边 2012-05-07
  • 打赏
  • 举报
回复
给个简单例子!楼主给的代码信息不足!很难去判断给出答案。
码无边 2012-05-07
  • 打赏
  • 举报
回复
[Quote=引用楼主 的回复:]
PHP code
$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, ……
[/Quote]
<?php
$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);
?>
xuzuning 2012-05-06
  • 打赏
  • 举报
回复
你给的信息实在是太少了
somebody-998 2012-05-06
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

抱歉没有仔细看你的问题就google了一下,显然你已经设置了那个
[/Quote]

谢谢你,折腾了好久还是折腾不出来
改一下昵称 2012-05-06
  • 打赏
  • 举报
回复
抱歉没有仔细看你的问题就google了一下,显然你已经设置了那个
改一下昵称 2012-05-06
  • 打赏
  • 举报
回复
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
加一句代码

http://curl.phptrack.com/forum/viewtopic.php?p=1294
qq120848369 2012-05-06
  • 打赏
  • 举报
回复
信息太少了

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧