Results 1 to 2 of 2

Thread: how to call this in php

  1. #1
    Join Date
    Oct 2015
    Posts
    5

    Default 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/_de...tions/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"
    }
    }'

  2. #2

    Default

    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 Code:
    <?php 
    $url 
    "http://[WOWZA-IP]:8086/livestreamrecord?option=overwrite&app=live&streamname=myStream&action=startRecording"
    $ch curl_init($url); 
    curl_setopt($chCURLOPT_FOLLOWLOCATION ,1); 
    curl_setopt($chCURLOPT_RETURNTRANSFER ,1); 
    curl_setopt($chCURLOPT_USERPWD"username:password"); 
    curl_setopt($chCURLOPT_HTTPAUTHCURLAUTH_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"

    ?>

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •