curl cookie 用法

<?php 
/*
#cookie用法
*/

$cookie_jar = tempnam('./tmp','cookie1'); 
// login 
$c=curl_init('http://www.nbchem.com/user/login.php?user=yourname&password=pwd&act=1'); 
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($c, CURLOPT_COOKIEJAR, $cookie_jar); 
curl_exec($c); 
curl_close($c); 
  
$c="http://www.nbchem.com/vip/"; 
$c=curl_init($c); 
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($c, CURLOPT_COOKIEFILE, $cookie_jar); 
$res=curl_exec($c); 
curl_close($c); 
echo $res;
?>

 

你可能感兴趣的:(C++,c,PHP,C#)