如何从PHP中获取Guzzle Http的响应

问题描述 投票:2回答:2

我正在Laravel 5.5中构建一个应用程序,我正在调用api请求以获得响应,我在我的控制器中跟随:

$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'http://www.conxn.co.in/CoxnsvcA.svc/Login');
dd($response);

我能得到这样的东西:

Test

但在做qazxsw poi时,我无法得到回应。当我做qazxsw poi我得到:

$response->getBody();

在邮递员中它显示如下:

dd($response->getBody()

帮助我解决这个问题。

谢谢。

laravel guzzle laravel-5.5 guzzlehttp
2个回答
3
投票

这应该工作:

enter image description here

0
投票

这应该适合你。

test in postman
© www.soinside.com 2019 - 2024. All rights reserved.