You first need to analyze what that line does:
$ curl -H "Authorization: 622cee5f8c99c81e87614e9efc63eddb" https://api.service.com/member
It's not complex, you find all switches explained on curl's manpage:
-H, --header <header>
: (HTTP) Extra header to use when getting a web page. You may specify any number of extra headers. [...]
You can add a header via curl_setopt_array
Docs in PHP (all available options are explained at curl_setopt
Docs):
$ch = curl_init('https://api.service.com/member');
// set URL and other appropriate options
$options = array(
CURLOPT_HEADER => false,
CURLOPT_HTTPHEADER => array("Authorization: 622cee5f8c99c81e87614e9efc63eddb"),
);
curl_setopt_array($ch, $options);
curl_exec($ch); // grab URL and pass it to the browser
curl_close($ch);
In case curl is blocked, you can do that as well with PHP's HTTP capabilities which works even if curl is not available (and it takes curl if curl is available internally):
$options = array('http' => array(
'header' => array("Authorization: 622cee5f8c99c81e87614e9efc63eddb"),
));
$context = stream_context_create($options);
$result = file_get_contents('https://api.service.com/member', 0, $context);