我从命令行运行的cURL命令是:
curl --digest -u "username:password" "http://[ip-address]:8086/streammanager/streamAction?action=resetStream" --data "vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream"
我面临的问题是命令的以下部分:
--data "vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream"
我在PHP代码中指定了哪些 --data
?
我到目前为止:
<?php
$url="http://[ip-address]:8086/streammanager/streamAction?action=resetStream";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'username:password');
$result = curl_exec($ch);
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch);
}
else
{
echo $result;
}
curl_close($ch);
?>
答案 0 :(得分:0)
$param = 'vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream';
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);