我試圖訪問API的任務管理系統(Nozbe是精確的)是這裏概述:http://www.nozbe.com/api使用訪問任務管理API與PHP捲曲
如果我走在我的瀏覽器,訪問網址它返回正確的JSON響應: {「迴應」:「644a40436」}
然而,當我試圖用捲曲訪問此網址在PHP中,它不會產生像它會說明,如果我手動訪問它在我的瀏覽器中。
$api_key = "INSERTAPIKEYHERE";
$project_id = "73d173457";
$eventtitle = "Testing";
$descrip = "This is a test";
$url = "http://www.nozbe.com/api/newnote/name-$eventtitle/body-$descrip/project_id-$project_id/key-$api_key";
echo "$url<br/><br/>";
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// grab URL and pass it to the browser
$response = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
沒有人有任何建議或指針,爲什麼這是不工作?我知道這可能是我試圖訪問的一個相當晦澀的API。
API調用返回什麼?它可能會給你一個錯誤信息,指出問題。 – Matchu 2011-03-08 21:27:03