Web services Box API新手连接问题

Web services Box API新手连接问题,web-services,api,registration,box-api,Web Services,Api,Registration,Box Api,我正在尝试连接到box api以读取我文件夹中用户的文件。我已经创建了文件夹并上传了文件,然后我转到OAuth2接口获取API密钥。它给了我api密钥,所以我将其粘贴到代码中: public function indexAction() { try { $uri = "https://api.box.com/2.0/folders/0/items?limit=100&offset=0"; $config = array(

我正在尝试连接到box api以读取我文件夹中用户的文件。我已经创建了文件夹并上传了文件,然后我转到OAuth2接口获取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?) 

我用“test”这个名字注册了这个应用程序。我做错了什么?我缺少什么?

您可以尝试在不使用
CURLOPT\u SSL\u VERIFYPEER
CURLOPT\u USERPWD
选项的情况下传递请求。我不认为这些是绝对必要的——据我所知,Box不进行任何客户端证书验证——它们可能是导致问题的原因。

单独使用Zend http客户端比使用curl适配器要好。此外,身份验证不需要用户名和密码。只有在从Box API的Oauth2授权过程接收到th访问令牌后,才能执行该操作。可以使用的zend http客户端调用如下:

 $client = new Zend_Http_Client('https://api.box.com/2.0/folders/0');
 $client->setMethod(Zend_Http_Client::GET);
 $client->setHeaders('Authorization: Bearer '.$access_token);
 $response = $client->request()->getBody();
我的2美分