So I created a function with a cURL request inside and I get the data to print out when I do print_r which is great. I don't know how to array_map the data tho.
public function request()
{
$resource = curl_init();
curl_setopt(
$resource,
CURLOPT_URL,
'https://etc....'
);
curl_setopt(
$resource,
CURLOPT_HTTPHEADER,
['API-Authorization: C:p']
);
curl_setopt(
$resource,
CURLOPT_REFERER,
'http://' . $_SERVER['SERVER_NAME'] . '/'
);
curl_setopt(
$resource,
CURLOPT_USERAGENT,
'F'
);
curl_setopt(
$resource,
CURLOPT_RETURNTRANSFER,
1
);
$response = json_decode(curl_exec($resource));
return $response;
}
So I have that cURL request and would like to array_map() it but I can't seem to get it to work properly, I have tried doing this:
$response = json_decode(curl_exec($resource));
$test[] = array_map('', $response);
return $test;
With no luck, does anyone know what I might be doing wrong?
$response = json_encode(['html' => curl_exec($resource)]);