Skip to content

Instantly share code, notes, and snippets.

@Rijen
Last active November 13, 2015 03:38
Show Gist options
  • Save Rijen/5739474ad0a9cd8aecd7 to your computer and use it in GitHub Desktop.
Save Rijen/5739474ad0a9cd8aecd7 to your computer and use it in GitHub Desktop.
<?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