Okay, so you have several options in there.
- -v
- –data “WSCommunityStringRW?2=1200ve50set&Submit=Submit”
- -u “admin[noparse]:x[/noparse]xxxxx”
- –anyauth
And the URL you want to request is:
[noparse]http://10.2.3.111/Forms/SnmpCommunityString[/noparse]
So let’s have a look at the first option, -v, cURL - How To Use says
-v/–verbose
Makes the fetching more verbose/talkative. Mostly useful for debugging. A line starting with ‘>’ means “header data” sent by curl, ‘<’ means “header data” received by curl that is hidden in normal cases, and a line starting with ‘*’ means additional info provided by curl.
Note that if you only want HTTP headers in the output, -i/–include might be the option you’re looking for.
If you think this option still doesn’t give you enough details, consider using --trace or --trace-ascii instead.
This option overrides previous uses of --trace-ascii or --trace.
Use -s/–silent to make curl quiet.
Okay, so it is to make it verbose. Let’s see if PHP’s cURL also has an option for that here PHP: curl_setopt - Manual
What do you know, CURLOPT_VERBOSE
TRUE to output verbose information. Writes output to STDERR, or the file specified using CURLOPT_STDERR.
Similarly, --data can be done by using CURLOPT_POSTFIELDS
For the authentication (–auth) you can use CURLOPT_USERPWD and for --auth-any you should set CURLOPT_HTTPAUTH to CURLAUTH_ANY
Lastly, the URL can be set with CURLOPT_URL
So, all in all
$ch=curl_init();
curl_setopt_array($ch, array(
// Return data instead of printing it
CURLOPT_RETURNTRANSFER => true,
// verbose (-v)
CURLOPT_VERBOSE => true,
// post data (--data)
CURLOPT_POSTFIELDS => array('WSCommunityStringRW?2'=>'1200ve50set', 'Submit'=>'Submit'),
// auth (--auth-any)
CURLOPT_HTTP_AUTH => CURLAUTH_ANY,
// username and password (--auth)
CURLOPT_USERPWD => 'admin:xxxxxx',
// the URL
CURLOPT_URL => 'http://10.2.3.111/Forms/SnmpCommunityString',
));
$data=curl_exec($ch);
curl_close($ch);
(not tested)