How does Curl's cookie work? The Novice has a headache, and curl has too many parameters, and the cookie section involves 4 of them.
Of course, the manual has written that Curl's cookie is 3, but it doesn't have a header parameter, it can contain cookies.
Curl is very useful. The main thing is to be familiar with the usage of curl_setopt.
curl_setopt ($ch, Curlopt_cookie, $cookie);
The value of the cookie here is to be used, separate, rather than &. Also do not need to use UrlEncode coding, of course, the code is better.
$cookie = "A=b;c=d;name= Fangshiyu";
Note that when using this, not in curl_setopt ($ch, Curlopt_httpheader, $header);
The $header contains the cookie parameters, otherwise it overlaps, causing the cookie to occur in unforeseen circumstances.
Attach the code used to analyze cookies in IE
!--? phpfunction Join_cookie ($cook) {foreach ($cook as $k =< $v) {$d [] = $k ." = ". $v; } $data = Implode (";", $d); return $data;} function Pase_cookie ($cookFile, $encode =true) {$cookie = file_get_contents ($cookFile); $citem = Explode ("*\n", $cookie) , foreach ($citem as $c) {list ($ckey, $cvalue) = explode ("\ n", $c), if ($ckey!=& #39; & #39;), $cook [$ckey] = $cvalue;} return $cook;}