Try to use official method for curl exec.
This commit is contained in:
parent
a21f117e78
commit
1fa7c6647f
@ -404,14 +404,20 @@ class InterfaceZapierTriggers extends DolibarrTriggers
|
|||||||
/**
|
/**
|
||||||
* Post webhook in zapier with object data
|
* Post webhook in zapier with object data
|
||||||
*
|
*
|
||||||
* @param string $url url provided by zapier
|
* @param string $url Url provided by zapier
|
||||||
* @param string $json data to send
|
* @param string $json Data to send
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function zapierPostWebhook($url, $json)
|
function zapierPostWebhook($url, $json)
|
||||||
{
|
{
|
||||||
$headers = array('Accept: application/json', 'Content-Type: application/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();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
@ -420,8 +426,10 @@ function zapierPostWebhook($url, $json)
|
|||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
|
||||||
$output = curl_exec($ch);
|
$output = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user