从Guzzle处理传入的数组

问题描述 投票:0回答:1

所以我一直试图让guzzle工作,我可以发送一个发送某种阵列的帖子请求,我想知道,我怎么能在端点接收它?我可以处理像if(isset($ _ POST ['nameHere']))而不是数组的东西

    $client = new Client();
    $response = $client->request('POST', 'http://httpbin.org/post', [
        'form_params' => [
            'email' => '[email protected]',
            'name' => 'Test user',
            'password' => 'testpassword',
        ],

        'debug' => true
    ]);
    echo '<pre>' . print_r((string)$response->getBody(), true) . '</pre>';
}

ps:我的自定义laravel应用程序是发送者,我的wordpress网站是接收者。

wordpress laravel httprequest guzzle
1个回答
0
投票

得到它的工作,我错过了.php结束在我的网址,因为我选择不用httpbin测试,而是直接用我的api测试。在wordpress我没有得到任何东西,因为这是我发布的发件人代码而不是接收者(wordpress)。我不知道如何测试它。不管怎么说,还是要谢谢你

© www.soinside.com 2019 - 2024. All rights reserved.