From 1fa7c6647f38ee8752283b86ab49c925ac8c30ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Aug 2022 21:20:04 +0200 Subject: [PATCH] Try to use official method for curl exec. --- ...interface_99_modZapier_ZapierTriggers.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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); + */ } /**