时间:2021-07-01 10:21:17 帮助过:10人阅读
$cookie_file=tempnam('./temp','cookie');
$login_url='https://account.xiaomi.com/pass/serviceLoginAuth';
$post ='user&pwd=&sid=eshop&callback=http%3A%2F%2Forder.xiaomi.com%2Flogin%2Fcallback%3Ffollowup%3Dhttp%253A%252F%252Fwww.xiaomi.com%252F%26sign%3DMjk4NmVlYzNiOWY5YTkwMjExNzg5MjkyNzE3ZmIxOGM4YTBiMDk1Mg%2C%2C&_sign=f%2FKB8SAfmaLZ0s28kcLtBSmZlEM%3D&_json=true'//避免不必要的麻烦 post的具体帐号密码去掉了
$ch=$curl=curl_init($login_url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_file);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
curl_exec($ch);
curl_close($ch);
$url="http://www.xiaomi.com/index.php";
$ch=curl_init($url);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,0);
curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_file);
$contents=curl_exec($ch);
curl_close($ch);
?>