php模拟登陆curl获取cookie那里错误??
我是按照php100教程操作的。。$cookie=tempnam('.','cookie');$url='http://bbs.php100.com/login.php'...
我是按照php100教程操作的。。
$cookie = tempnam('.','cookie');
$url='http://bbs.php100.com/login.php';
$curlPost='cktime=3600&step=2&pwuser=ceshiphp&pwpwd=111111';
//模拟登陆获取cookie
$ch = curl_init();//初始化curl
curl_setopt($ch,CURLOPT_URL, $url);//提交到指定网页
curl_setopt($ch,CURLOPT_HEADER,0); //header头部信息
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
curl_exec($ch);
curl_close($ch);
//获取内容页
$url='http://bbs.php100.com/index.php';
$ch = curl_init($url); //初始化
curl_setopt($ch,CURLOPT_HEADER,0); //header头部信息
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);//运行curl
curl_close($ch);
那里错误了?? 展开
$cookie = tempnam('.','cookie');
$url='http://bbs.php100.com/login.php';
$curlPost='cktime=3600&step=2&pwuser=ceshiphp&pwpwd=111111';
//模拟登陆获取cookie
$ch = curl_init();//初始化curl
curl_setopt($ch,CURLOPT_URL, $url);//提交到指定网页
curl_setopt($ch,CURLOPT_HEADER,0); //header头部信息
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
curl_exec($ch);
curl_close($ch);
//获取内容页
$url='http://bbs.php100.com/index.php';
$ch = curl_init($url); //初始化
curl_setopt($ch,CURLOPT_HEADER,0); //header头部信息
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);//要求结果为字符串且输出到屏幕上
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_exec($ch);//运行curl
curl_close($ch);
那里错误了?? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询