Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

haashe's avatar

How would i write this curl in guzzle?

I need help with curl and php... In API which I need to use I have example of CURL request: curl -X GET -H 'Authorization: Bearer {channel access token}' somerandomurl

But I dont know how I would write this in guzzle.

0 likes
4 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Why not use the http client?

$response = Http::withToken('channel access token')->post('somerandomurl')
haashe's avatar

@Sinnbeck What can I do about the error "message":"Authorization header required. Must follow the scheme, 'Authorization: Bearer <ACCESS TOKEN>'"?

Please or to participate in this conversation.