php - How i can use variables on json with Guzzle?

669

I'm trying to use variables in php to add values to the json on Guzzle, but that appear that's not working, i'm doing it wrong? Thanks in advance, im new in the use of Guzzle. (Guzzle 6)

$send_response = $send->post("https://yyy.com/services/" , [
  'headers' => [
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer ' .$token
  ],
  'json' => [
    'key' => $value,
    'key2' => $value2,
  ]
]);

People are also looking for solutions to the problem: php - Registration Form Type

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.