Posted in PHP onMarch 31, 2014
<?php $curl = curl_init(); $url = 'https://3water.com/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的示例
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@