我是 API 调用的新手
我需要在 PHP 中执行以下 CURL 调用:链接到 API 文档http://dev.ducksboard.com/apidoc/tutorial/#overview
curl -v -u APIKEY:x -d '{"value": 10}' https://push.ducksboard.com/values/235
我有以下更新的代码(但不工作):
<?php
$postData = array('value' => 10);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://push.ducksboard.com/v/*****');
curl_setopt($ch, CURLOPT_USERPWD, "000000000000000");
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
curl_setopt($ch, CURLOPT_POST, true);
$result=curl_exec ($ch);
curl_close ($ch);
echo $result;
?>