Answer the question
In order to leave comments, you need to log in
How to send a patch request via curl?
I want to send via Api 3 arguments name id phone
Decided to do it via curl
<?php
$apiKey = '**************************';
$url = '**************************';
$curl = curl_init();
$data = array(
"id" => "2e0df379-0e3c-470f-9b36-06b9e34c3bd",
"name" => "User Name",
"phone" => "7777777777",
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Basic '. $apiKey,
'Content-Type:application/json'
));
$response = curl_exec($curl);
curl_close($curl);
echo '<PRE>';
print_r($data);
echo '<PRE>';
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question