PHP using Curl to create a lead including inserting data into custom fields

are their any example of

PHP using Curl to create a lead including inserting data into custom fields

i can create a lead but then it comes to adding custom fields with data it doesn’t work

and if posting the data to the lead does it also have to be in json_encode()
eg
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($leadcustomfields));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Content-Type: application/json’));

Hello,

We use PHP to develop a Pipedrive application for a customer. We use a simpler library that can access PipeDrive API using OAuth.

If you are interested in this library, I can help you to make that API call.

The library is here:

https://www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html

Would you like to try this library so I can help you to define the right parameters to make that API call?