Use Guzzle to HTTP GET to external API with Symfony

I set the IP address from localhost:8087 to my windows IP address 192.168.x.x:8087.

It worked so there was no need to do anything with linux ports/docker ports etc.


This line: $client = new GuzzleHttp\Client(['base_uri' => 'http://my.api.url/']);

Should be:

$client = new Client(['base_uri' => 'http://my.api.url/']);

or:

$client = new \GuzzleHttp\Client(['base_uri' => 'http://my.api.url/']);

Either one would work since you imported the namespace. You probably want the first option. When you put GuzzleHttp\Client PHP thinks it's a relative namespace that's why it's saying "AppBundle\Controller\GuzzleHttp\Client" cannot be found.