php使用curl存储cookie的示例_PHP教程
-
原创
-
2016-07-13 10:34:58
762浏览
复制代码 代码如下:
$curl = curl_init();
$url = 'http://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);
http://www.bkjia.com/PHPjc/747677.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/747677.htmlTechArticle复制代码 代码如下: ?php $curl = curl_init(); $url = 'http://www.jb51.net/admin/gateway/login'; $data = array( 'username'='admin', 'password'='123' ); $cookie = tempnam('./t...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。