I’ve got a command line curl bit of code that I want to translate into php. I’m struggling.
Here’s the line of code
$ curl -H "Authorization: 622cee5f8c99c81e87614e9efc63eddb" https://api.service.com/member
the big string would be a variable I’d pass into it.
What does this look like in PHP?
You first need to analyze what that line does:
It’s not complex, you find all switches explained on curl’s manpage:
You can add a header via
curl_setopt_arrayDocs in PHP (all available options are explained atcurl_setoptDocs):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):