Obtener encabezado de respuesta PHP cURL
Soy nuevo en PHP. Estoy tratando de obtener el encabezado de la respuesta después de enviar la solicitud POST de php curl. El cliente envía la solicitud al servidor y el servidor devuelve la respuesta con Encabezado. Así es como envié mi solicitud POST.
$client = curl_init($url);
curl_setopt($client, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($client, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($client, CURLOPT_HEADER, 1);
$response = curl_exec($client);
var_dump($response);
Aquí está la respuesta del encabezado del servidor que obtengo del navegador
HTTP/1.1 200 OK
Date: Wed, 01 Feb 2017 11:40:59 GMT
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2Vycy9CYW9CaW5oMTEwMiIsIm5hbWUiOiJhZG1pbiIsInBhc3N3b3JkIjoiMTIzNCJ9.kIGghbKQtMowjUZ6g62KirdfDUA_HtmW-wjqc3ROXjc Content-Type: text/html;charset=utf-8 Transfer-Encoding: chunked Server: Jetty(9.3.6.v20151106)
¿Cómo puedo extraer la parte de autorización del encabezado? Necesito almacenarlo en las cookies.