Created
October 28, 2018 14:59
-
-
Save ggramaize/03e49ba65a753846575787b0aff2dca0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$service_url = 'http://www.hampager.de:8080/calls'; | |
$username = 'n0call'; | |
$password = 'geheim'; | |
$body = array( | |
'text' => "F4HOF: Ceci est un autre test de l'API REST Dapnet. 73", | |
'callSignNames' => array( | |
'f4hof' | |
), | |
'transmitterGroupNames' => array('all'), | |
'emergency' => false | |
); | |
$reqOpts = array( | |
'http' => | |
array( | |
'method' => 'POST', | |
'header' => array( | |
'Content-Type: application/json', | |
'Authorization: Basic '. base64_encode($username.':'.$password) | |
), | |
'content' => json_encode( $body) | |
) | |
); | |
$sContext = stream_context_create( $reqOpts); | |
$result = file_get_contents( $service_url, false, $sContext); | |
if( $result == false ) | |
{ | |
$error = error_get_last(); | |
echo('Request failed: ' . $error['message']); | |
} | |
var_dump($result); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment