Wowza Community

Wowza Streaming Curl command code translation to the PHP

Hi Guys,

I know this is not the Programming forums but this forums is related to the wowza and my question is totally related to the WOWZA.

I have check this JSON String

https://www.wowza.com/docs/stream-targets-query-examples-push-publishing

<?php
$username = 'test';
$password = 'test';
$data = array(
"restURI" => "http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myStream/pushpublish/mapentries/ppsource",
"serverName" => "_defaultServer_",
        "sourceStreamName" => "myStream",
        "entryName" => "RTMP",
        "profile" => "rtmp",
        "host" => "rtmp",
        "application" => "myStream",
        "streamName"=>   "test",
        "userName" => "",
        "password"=> "",
        "debugPackets"=>"true",
        "sendReleaseStream"=>"false",
        "sendStreamCloseCommands"=>"false",
        "debugLog"=>"true",
        "destinationName"=>"rtmp",
        ); 
    $data_string = json_encode($data);
$url = 'http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myStream/pushpublish/mapentries/ppsource';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_string))
);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec( $ch );
echo $result;
echo "data";

ERROR:

HTTP/1.1 401 Unauthorized
        Content-Type: text/xml; charset=UTF-8
        Date: Fri, 17 Jun 2016 18:43:07 GMT
        Accept-Ranges: bytes
        Server: Restlet-Framework/2.2.2
        WWW-Authenticate: Digest realm="Wowza", domain="/", nonce="dfsdfdfsdfsdfsdfsdfsdfTRlYjE1ZTgzZGYxODFmODQyZjYwYg=="algorithm=MD5, qop="auth"
        Connection: keep-alive
        Transfer-Encoding: chunked
       <?xml version="1.0" encoding="UTF-8" standalone="no"?><error><wowzaServer>4.2.0 < /wowzaServer><code>401</code><message>The request requires user authentication</message></error>data</body>
*<message>The request requires user authentication</message>*

I am getting

USER Authentication problem

any help will apprenticed.

THANKS in advance.

Hello,

Have you followed the steps here previously:

https://www.wowza.com/docs/how-to-access-documentation-for-wowza-streaming-engine-rest-api

to disable the authentication?

Can you then make these calls through the documentation interface?

If this has already been tested, can you post what you now have for:

On the computer that has the Wowza Streaming Engine software installed, open the [install-dir]/conf/Server.xml file in a text editor.

Change the / property from:

digest

to:

DocumentationServerAuthenticationMethod>none

Regards,

Jason Hatchett