$cookie_file = tempnam('./temp','cookie');
$login_url = "http://xingdong365.com/action/index.php?action=login";
$post_fields = "cktime=3600&user=*****&pw=******&action=login";
$ch = curl_init($login_url);//设置你需要抓取的URL
curl_setopt($ch, CURLOPT_HEAD,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//设置cURL 参数,要求结果保存到字符串中还是输出到屏幕上
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
$data = curl_exec($ch);//运行cURL,请求网页
curl_close($ch);
$url ="http://xingdong365.com/action/sort.php";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEAD,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$contents = curl_exec($ch);
preg_match('/<option value="1">(.*)<\/option>/',$contents,$arr);
echo $arr[1];
curl_close($ch);
action
本站未注明转载的文章均为原创,并采用
CC BY-NC-SA 4.0授权协议,
转载请注明来源,谢谢!如本站内容对你有所帮助的话,欢迎订阅关注
邢栋博客,唠嗑(分享)每日的折腾经历。
已有 0 条评论