问题描述:

I have started to use GuzzleHttp\Client and I have problem to get response from REST API, because I am getting error 404 code. I don't understand it because when I copied url from my code and paste into browser I will see json response. Do you have any idea what I am doing wrong?

$client = new GuzzleHttp\Client();

$response = $client->get('http://login:[email protected]_to_api/get/some_products');

$json = $response->json();

网友答案:

I don't think, that you can add your login credentials like that. Here is the right way: http://guzzle.readthedocs.org/en/latest/clients.html#auth

相关阅读:
Top