0

The cURL command that I run from the command line is:

curl --digest -u "username:password" "http://[ip-address]:8086/streammanager/streamAction?action=resetStream" --data "vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream"

The problem I am facing is with the following part of the command:

 --data "vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream"

Where in PHP code do I specify --data?

I got this far:

<?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);
?>
2

1 Answer 1

0
$param = 'vhostName=_defaultVHost_&appName=rtr_planeta/_definst_&streamName=rtr_planeta.stream';
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.