# how to call this in php

**URL:** <https://community.wowza.com/t/how-to-call-this-in-php/46034>\
**Category:** Wowza Streaming Engine\
**Created:** [November 11, 2015, 8:39pm UTC](https://community.wowza.com/t/how-to-call-this-in-php/46034 "2015-11-11T20:39:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vincent\_aaron](https://avatars.discourse-cdn.com/v4/letter/v/85e7bf/32.png) [@vincent\_aaron](https://community.wowza.com/u/vincent_aaron)\
**Post date:** [November 11, 2015, 8:39pm UTC](https://community.wowza.com/t/how-to-call-this-in-php/46034/1 "2015-11-11T20:39:58Z")

</div>

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](http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/testlive) -d’

{

“restURI”: “[http://localhost:8087/v2/servers/](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/](http://localhost:8087/v2/servers/)_defaultServer_/vhosts/_defaultVHost_/applications/testlive/streamconfiguration”,

“streamType”: “live”

}

}’

---

<div class="post-metadata">

**Author:** ![Paul\_Shields](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/paul_shields/32/390_2.png) [@Paul\_Shields](https://community.wowza.com/u/Paul_Shields)\
**Post date:** [November 12, 2015, 11:56am UTC](https://community.wowza.com/t/how-to-call-this-in-php/46034/2 "2015-11-12T11:56:39Z")

</div>

Hi,

You could look at using [curl\_setopt](http://php.net/manual/en/function.curl-setopt.php). 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
