<?php
$curl = curl_init();
$url = 'https://www.jb51.net/admin/gateway/login';
$data = array(
'username'=>'admin',
'password'=>'123'
);
$cookie = tempnam('./temp','cookie');
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_POST,count($data));
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
curl_setopt($curl,CURLOPT_COOKIEJAR,$cookie);
ob_start();
curl_exec($curl);
$result = ob_get_contents();
ob_end_clean();
curl_close($curl);
php使用curl存储cookie的示例
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:http://www.heiqu.com/8eb9868bfb859dfa4e5cfc8d7de83bdc.html