ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
IFTTTHandler.php
Go to the documentation of this file.
1
<?php
2
3
/*
4
* This file is part of the Monolog package.
5
*
6
* (c) Jordi Boggiano <j.boggiano@seld.be>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
Monolog\Handler
;
13
14
use
Monolog\Logger
;
15
27
class
IFTTTHandler
extends
AbstractProcessingHandler
28
{
29
private
$eventName
;
30
private
$secretKey
;
31
38
public
function
__construct
(
$eventName
,
$secretKey
,
$level
=
Logger::ERROR
,
$bubble
=
true
)
39
{
40
$this->eventName =
$eventName
;
41
$this->secretKey =
$secretKey
;
42
43
parent::__construct(
$level
,
$bubble
);
44
}
45
49
public
function
write
(
array
$record)
50
{
51
$postData
=
array
(
52
"value1"
=> $record[
"channel"
],
53
"value2"
=> $record[
"level_name"
],
54
"value3"
=> $record[
"message"
],
55
);
56
$postString = json_encode(
$postData
);
57
58
$ch = curl_init();
59
curl_setopt($ch, CURLOPT_URL,
"https://maker.ifttt.com/trigger/"
. $this->eventName .
"/with/key/"
. $this->secretKey);
60
curl_setopt($ch, CURLOPT_POST,
true
);
61
curl_setopt($ch, CURLOPT_RETURNTRANSFER,
true
);
62
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
63
curl_setopt($ch, CURLOPT_HTTPHEADER,
array
(
64
"Content-Type: application/json"
,
65
));
66
67
Curl\Util::execute
($ch);
68
}
69
}
Monolog\Handler
Definition:
AbstractHandler.php:12
Monolog\Logger\ERROR
const ERROR
Runtime errors.
Definition:
Logger.php:57
Monolog\Handler\AbstractProcessingHandler
Base Handler class providing the Handler structure.
Definition:
AbstractProcessingHandler.php:22
Monolog\Handler\IFTTTHandler\$eventName
$eventName
Definition:
IFTTTHandler.php:29
Monolog\Handler\Curl\Util\execute
static execute($ch, $retries=5, $closeAfterDone=true)
Executes a CURL request with optional retries and exception on failure.
Definition:
Util.php:32
Logger
Monolog\Handler\IFTTTHandler\__construct
__construct($eventName, $secretKey, $level=Logger::ERROR, $bubble=true)
Definition:
IFTTTHandler.php:38
Monolog\Handler\IFTTTHandler
IFTTTHandler uses cURL to trigger IFTTT Maker actions.
Definition:
IFTTTHandler.php:27
Monolog\Handler\IFTTTHandler\$secretKey
$secretKey
Definition:
IFTTTHandler.php:30
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
$postData
if($session===NULL) $postData
Definition:
postredirect.php:34
Monolog\Handler\AbstractHandler\$level
$level
Definition:
AbstractHandler.php:25
Monolog\Handler\IFTTTHandler\write
write(array $record)
{}
Definition:
IFTTTHandler.php:49
Monolog\Handler\AbstractHandler\$bubble
$bubble
Definition:
AbstractHandler.php:26
libs
composer
vendor
monolog
monolog
src
Monolog
Handler
IFTTTHandler.php
Generated on Sat Jan 18 2025 19:01:05 for ILIAS by
1.8.13 (using
Doxyfile
)