php-func-lib/troy-api.php
2022-01-09 13:27:20 +01:00

15 lines
487 B
PHP

<?php
function sendToTroy($data) {
$url = 'https://troy-grunt/api.php';
// use key 'http' even if you send the request to https://...
$options = array (
'http' => array (
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => json_encode ( $data )
)
);
$context = stream_context_create ( $options );
return file_get_contents ( $url, false, $context );
}
?>