我想連接到box-api來閱讀我的用戶在我的文件夾中的文件。我創建了文件夾並上傳了文件,然後我去了OAuth2界面以獲取API密鑰。它給了我的API密鑰,所以我粘貼在代碼中:框API新手連接問題
public function indexAction()
{
try {
$uri = "https://api.box.com/2.0/folders/0/items?limit=100&offset=0";
$config = array(
'adapter' => 'Zend_Http_Client_Adapter_Curl',
'curloptions' => array(CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTPHEADER=>array("Authorization: Bearer MYKEY"),
CURLOPT_SSL_VERIFYPEER, false,
CURLOPT_USERPWD, "user:password"),
);
$client = new Zend_Http_Client($uri, $config);
$response = $client->request();
$text= $response->getBody();
} catch (Zend_Exception $e) {
echo "Message: " . $e->getMessage() . "\n";
// Other code to recover from the error
}
}
我得到的錯誤是:
Message: Error in cURL request: unable to use client certificate (no key found or wrong pass phrase?)
我註冊了一個名爲「測試」的應用程序。我做錯了什麼?我錯過了什麼?