diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index f9cfd8675e0..d706488129e 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -404,14 +404,20 @@ class InterfaceZapierTriggers extends DolibarrTriggers /** * Post webhook in zapier with object data * - * @param string $url url provided by zapier - * @param string $json data to send + * @param string $url Url provided by zapier + * @param string $json Data to send * @return void */ function zapierPostWebhook($url, $json) { $headers = array('Accept: application/json', 'Content-Type: application/json'); - // TODO supprimer le webhook en cas de mauvaise réponse + + // TODO disable wekhook if error ? + + dol_syslog("Send message to Zapier with json size=".dol_strlen($json), LOG_DEBUG); + getURLContent($url, 'POSTALREADYFORMATED', $json, 1, $headers, array('http', 'https'), 0); + + /* $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); @@ -420,8 +426,10 @@ function zapierPostWebhook($url, $json) curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + $output = curl_exec($ch); curl_close($ch); + */ } /**