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