Wowza curl命令没有验证

时间:2016-06-17 18:57:41

标签: php ubuntu curl libcurl wowza

这是我的curl命令,我已将其翻译成用于创建WOWZA Stream的php代码。

<?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";

当我运行此命令时,我收到此错误。有人可以帮助我,我在做任何错误。

错误代码

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>*

我不知道我哪里错了

0 个答案:

没有答案