how to call this in php

can anyone give me a tutorial or example on how to call this api via php script from a remote pc?

curl -X POST --header ‘Accept:application/json; charset=utf-8’ --header ‘Content-type:application/json; charset=utf-8’ http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive -d’

{

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive”,

“name”: “testlive”,

“appType”: “Live”,

“clientStreamReadAccess”: “*”,

“clientStreamWriteAccess”: “*”,

“description”: “Testing our Rest Service”,

“streamConfig”: {

“restURI”: “http://localhost:8087/v2/servers/defaultServer/vhosts/defaultVHost/applications/testlive/streamconfiguration”,

“streamType”: “live”

}

}’

Hi,

You could look at using curl_setopt. You can then create a php script in this way (this example is to start a recording)

[php]

<?php $url = "http://[WOWZA-IP]:8086/livestreamrecord?option=overwrite&app=live&streamname=myStream&action=startRecording"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); curl_setopt($ch, CURLOPT_USERPWD, "username:password"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); $contents = curl_exec($ch); $status = curl_getinfo($ch,CURLINFO_HTTP_CODE); curl_close($ch); //var_dump($contents); if(intval($status)==200){ echo "Success"; } else{ echo "Failed"; } ?>

[/php]

Paul