Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Zend_Oauth的问题_Php_Zend Framework_Oauth - Fatal编程技术网

Php Zend_Oauth的问题

Php Zend_Oauth的问题,php,zend-framework,oauth,Php,Zend Framework,Oauth,有人能在下面签出我的代码吗?我正在尝试与Vzaar(.com)通信,无法授权。看起来我发送了正确的授权标题,但不是100%。我想不出还有什么 class Vzaar { /** * * @var Zend_Oauth_Token_Access */ protected $_oAuth; /** * * @var Zend_Oauth_Client */ protected $_oClient; p

有人能在下面签出我的代码吗?我正在尝试与Vzaar(.com)通信,无法授权。看起来我发送了正确的
授权
标题,但不是100%。我想不出还有什么

class Vzaar {
    /**
     *
     * @var Zend_Oauth_Token_Access
     */
    protected $_oAuth;
    /**
     *
     * @var Zend_Oauth_Client
     */
    protected $_oClient;
    protected $_sUsername;
    protected $_sSecret;
    protected $_sEndPoint = 'http://vzaar.com/api/';

    public function __construct($sUsername, $sSecret) {
        $this->_sUsername = $sUsername;
        $this->_sSecret = $sSecret;
        $this->_oAuth = new Zend_Oauth_Token_Access();
        $this->_oAuth->setToken($this->_sUsername);
        $this->_oAuth->setTokenSecret($this->_sSecret);
        $this->_oClient = $this->_oAuth->getHttpClient(array());
    }

    public function getVideos($sUsername = null) {
        if (null === $sUsername) {
            $sUsername = $this->_sUsername;
        }
        return $this->_request($sUsername . '/videos');
    }

    protected function _request($sUri) {
        $this->_oClient->setUri($this->_sEndPoint . 'test/whoami');
        $this->_oClient->setUri($this->_sEndPoint . $sUri . '.json');
        $this->_oClient->prepareOauth();
        Zend_Debug::dump($this->_oClient->getUri(true));
        Zend_Debug::dump($this->_oClient->getHeader('Authorization'));
        $oRequest = $this->_oClient->request();
        Zend_Debug::dump($oRequest->getHeaders());
        Zend_Debug::dump($oRequest->getRawBody());

        return Zend_Json::decode($oRequest->getBody());
    }

}

问题是API只接受GET请求。啊

public function __construct($sUsername, $sSecret) {
    /*** snip ***/
    $this->_oClient = $this->_oAuth->getHttpClient(array(
        'requestMethod' => Zend_Oauth_Client::GET
    ));
    /*** snip ***/
}