Last active
November 13, 2015 03:38
-
-
Save Rijen/5739474ad0a9cd8aecd7 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 | |
$par = isset($_POST['params'])?$_POST['params']:[]; | |
print send_otrs($_POST['method'], $par); | |
function send_otrs($method, $data) | |
{ | |
$data['UserLogin'] = 'oktell'; | |
$data['Password'] = 'oktell'; | |
$ch = curl_init('http://192.168.5.101/otrs/nph-genericinterface.pl/Webservice/oktell/' . $method); | |
$data_string = json_encode($data); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($data_string)) | |
); | |
$result = curl_exec($ch); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment