Hello all. I am a self taught developer and therefore only know what i have done so please be nice. I am trying to figure out how to use an XML API from cisco. They have given the following example.
POST http://<server>/vmrest/users?templateAlias=voicemailusertemplate
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<User>
<Alias>jdoe</Alias>
<DtmfAccessId>7890</DtmfAccessId>
</User>
presumably if I really knew what I was doing this would make sense to me however it does not. I would like to be able to perform this function through a web interface with php. After doing some searching I found the following bit of code that I tried manipulate to to complete the function above however I am having problems getting it to work.
<?php
//You can use 'POST','GET','PUT' or 'DELETE'
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<User>
<Alias>jdoe</Alias>
<DtmfAccessId>7890</DtmfAccessId>
</User>';
$auth = base64_encode('username:password');
$header = array("Authorization: Basic $auth");
$opts = array(
'http'=>array(
'method'=>'POST',
'header'=>$header,
'content'=>$xml
)
);
$context = stream_context_create($opts);
/* Sends an http request to www.example.com
with additional headers shown above */
$url = 'http://172.16.16.121/vmrest/users?templateAlias=voicemailusertemplate';
$fp = fopen($url, 'r', false, $context);
fpassthru($fp);
fclose($fp);
?>
If anyone could help point me in the right direction I would much appreciate it. Thank you