Meipai has over 100 million users and millions of active users every day. This is an opportunity for us to use Meipai for marketing//Login<br>
function get_login($phone="mobile phone number", $password="password") {<br>
<br>
$post = array(<br>
‘phone’ => $phone,<br>
'phone_flag' => 86,<br>
'password' => $password,<br>
‘auto_login’ => false<br>
);<br>
<br>
$cookie = './Cookie/'.$phone.".txt";<br>
<br>
$curl = curl_init();<br>
curl_setopt($curl, CURLOPT_URL, "http://www.meipai.com/user/login");<br>
curl_setopt($curl, CURLOPT_HEADER, 0);//Whether to display header information<br>
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);<br>
curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie); //Set cookie information to be saved in the specified file<br>
curl_setopt($curl, CURLOPT_POST, 1);//Submit via post<br>
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));//Information to be submitted<br>
curl_setopt($curl, CURLOPT_REFERER, 'http://www.meipai.com/');<br>
$json=curl_exec($curl);<br>
curl_close($curl);<br>
$data=json_decode($json,true);<br>
$data['cookie'] = $cookie;<br>
//Login successful, return cookie path<br>
Return $data;<br>
}<br>
<br>
//Like <br>
function get_likes($id="video id number",$cookie="cookie path"){<br>
<br>
$post = array(<br>
'id' => $id,<br>
);<br>
<br>
$curl = curl_init(); //Initialize curl<br>
curl_setopt($curl, CURLOPT_URL, "http://www.meipai.com/media/likes_create");<br>
curl_setopt($curl, CURLOPT_HEADER, 0); //Whether to display header information<br>
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); //Browser output<br>
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie); //Cookie<br>
curl_setopt($curl, CURLOPT_POST, 1);//Submit via post<br>
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));//Information to be submitted<br>
curl_setopt($curl, CURLOPT_REFERER, "http://www.meipai.com/");<br>
$json=curl_exec($curl);<br>
curl_close($curl); //Close curl<br>
$data=json_decode($json,true);<br>
//The like is successful and the corresponding status code is returned<br>
Return $data;<br>
}<br>
<br>
//Mengxue PHP communication group 324098841
The case has been written http://www.php127.com/meipai/