POSTing cURL to Zapier Webhook POSTing cURL to Zapier Webhook curl curl

POSTing cURL to Zapier Webhook


You need to json encode the data you are sending and set the content-type also:

Change:

$opts = array(    CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd',    CURLOPT_RETURNTRANSFER  => true,    CURLOPT_CUSTOMREQUEST   => 'POST',    CURLOPT_POST            => 1,    CURLOPT_POSTFIELDS      => 'guid='+ $_POST["guid"] + '&video_title=' + $_POST["video_title"] + '&email=' + $_POST["email"], );

to:

$data = array('guid' => $_POST["guid"], 'video_title' => $_POST["video_title"], 'email' => $_POST["email"]);$jsonEncodedData = json_encode($data);$opts = array(    CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd',    CURLOPT_RETURNTRANSFER  => true,    CURLOPT_CUSTOMREQUEST   => 'POST',    CURLOPT_POST            => 1,    CURLOPT_POSTFIELDS      => $jsonEncodedData,    CURLOPT_HTTPHEADER  => array('Content-Type: application/json','Content-Length: ' . strlen($jsonEncodedData))                                                                       );

This should work.


Your not sending the POSTFIELDS correctly, you need to use . not + and also you should be url encoding the string...

$opts = array(    CURLOPT_URL             => 'https://zapier.com/hooks/catch/n/abcd',    CURLOPT_HEADER          => false,    CURLOPT_RETURNTRANSFER  => true,    CURLOPT_POST            => true,    CURLOPT_POSTFIELDS      => http_build_query(array('guid' => $_POST['guid'], 'video_title' => $_POST['video_title'], 'email' => $_POST['email'])));


You don't receive it in Zapier because you haven't set the 'Child key' structure.Take a look at what you need to do inside the image below.

Keep in mind that in my case I wanted to catch the 'company_name'. You'll have to replace it with your own parameter. You can also define additional parameters or even completely change the 'Child key' structure.

enter image description here