$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);首先需要虚拟登录,然后在采集,但是我都虚拟登录不了,这是怎么回事,能教教吗? |