<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "",
//return the transfer as a string
CURLOPT_RETURNTRANSFER => true,
//enable headers
CURLOPT_HEADER => true,
//get only headers
CURLOPT_NOBODY => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"password: ",
"username: "
),
));
// $response contains the output string
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
print_r($response);
?>
I am trying to take $response and truncate data from it.My output of $response is
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 access-token: a3581f021476e4fb406c6b7c79e4095cece5d0c6 token-expiration-hours: 24 Content-Type: application/json Content-Length: 0 Date: Tue, 21 Aug 2018 14:12:27 GMT
I would like $response to just be the value of the access-token a3581f021476e4fb406c6b7c79e4095cece5d0c6