Skip to content

Instantly share code, notes, and snippets.

@lizheming
Created November 6, 2012 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizheming/4025035 to your computer and use it in GitHub Desktop.
Save lizheming/4025035 to your computer and use it in GitHub Desktop.
模拟登陆虾米获取登陆后的COOKIES
<?php
$name = ''; //输入你的账号
$password = ''; //输入你的密码
$curl_post = 'email='.$name.'&password='.$password.'&done=/&submit=登 录';
$cookie_file = dirname(__FILE__).'/cookie.txt';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://www.xiami.com/member/login");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post);
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_file);
curl_exec($curl);
curl_close($curl);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment