$ch = curl_init('http://www.google.com/');curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// get headers too with this linecurl_setopt($ch, CURLOPT_HEADER, 1);$result = curl_exec($ch);// get cookie// multi-cookie variant contributed by @Combuster in commentspreg_match_all('/^Set-cookie:s*([^;]*)/mi', $result, $matches);$cookies = array();foreach($matches[1] as $item) { parse_str($item, $cookie); $cookies = array_merge($cookies, $cookie);}var_dump($cookies);


