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

时间:2017-12-15 10:12:24

标签: laravel guzzle laravel-5.5 guzzlehttp

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

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

我能够得到这样的东西:

Test

但在做$response->getBody();的同时,我还没有得到回应。当我做dd($response->getBody()时,我得到了:

enter image description here

在邮递员中它显示的内容如下:

test in postman

帮我解决这个问题。

感谢。

2 个答案:

答案 0 :(得分:3)

这应该有效:

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

$response_body = json_decode($response->getBody());

答案 1 :(得分:0)

这应该适合你。

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$A$2" Then
    Cancel = True
    Application.EnableEvents = False
    reviewActiveSheetOrder
    Application.EnableEvents = True
End If
End Sub
相关问题