I'm trying to get the response from a json porst with guzzle in a simple php.
This is the function in a laravel project that does the post for a url. (I'm using var_dump to show the result in the terminal).
public function getPhotos($properties)
{
$codes = [];
foreach($properties as $property)
{
$codes[$property['codigo']] = $property['cod_filial'];
}
$client = new Client();
$response = $client->request('POST', 'http://local.app/file2.php', ['json' => \GuzzleHttp\json_encode($codes)]);
var_dump($response); exit;
}
This is the php file mapped to http://local.app/file2.php
<?php
$input = file_get_contents('php://input');;
$input = json_decode($input);
echo $input;
The Guzzle me response empty. Can someone help me? Thanks