1
0

added custom script plus some debugging

This commit is contained in:
2022-01-03 21:11:52 +01:00
parent d79463fbd4
commit 5224d00d5a
10 changed files with 173 additions and 55 deletions

View File

@ -13,24 +13,32 @@ class notificationFreemobile
function send($message)
{
global $curlErr;
$result = false;
if ($this->active == true)
{
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, $this->url . $message);
curl_setopt($ch, CURLOPT_URL, $this->url . urlencode(trim($message)));
echo $this->url . urlencode(trim($message)) . EOL;
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
if (($result = curl_exec($ch)) === false)
// $result contains the output string
echo "1 curlErr =>"; var_dump($curlErr); echo EOL;
if ($curlErr <= 10)
{
logger(ERROR, _(sprintf( "Curl return error: %s when sending notification", curl_error($ch))));
}else
{
logger(INFO, _("Curl return: ") . $result . _(" when sending notification"));
$result = curl_exec($ch);
echo "1 result => "; var_dump($result);echo EOL;
if ($result === false)
{
$curlErr += 1;
logger(ERROR, sprintf( _("Curl return error %d: %s when sending notification"), curl_errno($ch), curl_error($ch)), false);
}else
{
logger(INFO, sprintf(_("Curl return: %s when sending notification"), $result), false);
}
}
// close curl resource to free up system resources
curl_close($ch);
return true;