Reputation: 45
These codes throw "Bad Request" error because of parameter. What is the problem of parameter syntax.
try{
$client = new Client();
$response = $client->post("url",
['s' => $s, 'p'=> $p]);
} catch (ClientException $e) {
echo $e->getMessage();
} catch (RequestException $e) {
echo $e->getMessage();
}
Upvotes: 1
Views: 1044
Reputation: 935
You can use Http::post();
use Illuminate\Support\Facades\Http;
$response = Http::post('http://example.com/users',['your data']);
Upvotes: 1