0

我有一个命令,我在转换为 php 时遇到问题。

curl -i -X POST -u user:userpass --url http://cloud.netelignet.ca/virtual_machines/:virtual_machine_id/startup.xml

4

1 回答 1

0

我认为它等同于以下内容:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://cloud.netelignet.ca/virtual_machines/:virtual_machine_id/startup.xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$username = 'user'; $password = 'userpass';
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HEADER, 1);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
于 2013-01-11T19:18:30.947 回答