Try to use official method for curl exec.

This commit is contained in:
Laurent Destailleur 2022-08-27 21:20:04 +02:00
parent a21f117e78
commit 1fa7c6647f

View File

@ -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);
*/
}
/**