【发布时间】:2014-01-07 15:35:40
【问题描述】:
我正在尝试连接到 box-api 以读取我的用户在我的文件夹中的文件。我已经创建了文件夹并上传了文件,然后我去 OAuth2 接口获取 API Key。它给了我 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
}
}
关注这个tutorial on youtube。
我得到的错误如下:
Message: Error in cURL request: unable to use client certificate (no key found or wrong pass phrase?)
我使用名称“test”注册了应用程序。我做错了什么?我错过了什么?
【问题讨论】:
标签: web-services api registration box-api