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

LadyDeathKZN's avatar

L7 Http instead of cURL

Good day everyone,

I wanted to know if one can convert the below to a Http::get.... function instead of using cURL. I am using the waveapp package, but was wondering how this would be done

curl -X POST "https://gql.waveapps.com/graphql/public" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{ "query": "query { user { id defaultEmail } }", "variables": {} }'
$response = Http::withToken('token here')->get('https://gql.waveapps.com/graphql/public', [
	'query' => ['user' => ['id', 'defaultEmail']];
])
0 likes
3 replies
laracoft's avatar
laracoft
Best Answer
Level 27

@ladydeathkzn

$response = Http::withToken('token here')->withBody('{ "query": "query { user { id defaultEmail } }", "variables": {} }',  'application/json')->post('https://gql.waveapps.com/graphql/public')

Please or to participate in this conversation.