1

I'm trying to communicate to an API with laravel using guzzleHttp but I can't receive nothing.

If I test in postman returns me information. In postman I set the configuration as you see in image:

In code I'm trying to do that:

$token = env('API_TOKEN');
    $company = env('API_COMPANY_ID');
    $link = 'https://xpto.pt/APIs.aspx/Con';

    $data = array('token' => $token, 'empresa' => $company);
    $data = json_encode($data);
    echo $data;
    $client = new Client();
    $request = $client->post($link,  ['raw'=>$data]);
    $response = $request->send();

    dd($response);

Thank you

user3242861
  • 1,839
  • 12
  • 48
  • 93
  • I am also having a problem using guzzleHttp. So I have to use different approach. – Japs Oct 09 '19 at 00:15
  • Possible duplicate of [How can I use Guzzle to send a POST request in JSON?](https://stackoverflow.com/questions/22244738/how-can-i-use-guzzle-to-send-a-post-request-in-json) – miken32 Oct 10 '19 at 18:42

0 Answers0