China_好备胎
2016-08-09 17:51
$cookie_file = tempnam('./wei1','wei');
$login_url = 'http://web.umeng.com/main.php?c=user&a=login';
$post_fields ='username=88888&password=123456';
$ch = curl_init($login_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$arr=curl_exec($ch);
curl_close($ch);
$url='https://web.umeng.com/main.php?siteid=1256657021&c=flow&a=trend&ajax=module=flash&st=2016-08-09&et=2016-08-09&type=Line&Period=Hour&Quota=pv&_=1470735753213';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
$contents = curl_exec($ch);
echo $contents;
curl_close($ch);
这样写有什么不对吗,都登录不上CNZZ, 是怎么回事?
cnzz的用户名和密码字段名应该不是username和password,去百度一下就知道字段名是什么了
PHP中的数据传输神器cURL
34279 学习 · 218 问题
相似问题