How To Use And Send PHP curl Post Request Example

PHP 8 , PHP

Nicesnippets

163

15-09-2021


How To Use And Send PHP curl Post Request Example

Hi guys,

Today i will explained How To Use And Send PHP curl Post Request. This example is so easy to use in php.

This Exxample TO i am send To the post request using php curl through. And return Get To Response in php curl post request through.

So let's start to the example.

<?php

$post = [

'first_name' => 'test',

'last_name' => 'test last',

'email' => '[email protected]',

];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://api.Nicesnippets.com/api/users');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));

$response = curl_exec($ch);

var_export($response);

?>

Now you can check your own.

I hope it can help you...


Recommended Posts