/** * Return an instance of Zend_Http_Client configured to use the Query * String scheme for an OAuth driven HTTP request. * * @param array $params * @param string $url * @return \Zend\Http\Client */ public function getRequestSchemeQueryStringClient(array $params, $url) { $client = OAuth::getHttpClient(); $client->setUri($url); $client->getUri()->setQuery($this->_httpUtility->toEncodedQueryString($params)); $client->setMethod($this->_preferredRequestMethod); return $client; }
public function testUrlEncodeCorrectlyEncodesU3001() { $string = '、'; $this->assertEquals('%E3%80%81', Http\Utility::urlEncode($string)); }
/** * Convert Token to a string, specifically a raw encoded query string. * * @return string */ public function toString() { return $this->_httpUtility->toEncodedQueryString($this->_params); }
/** * Get base signature string * * @param array $params * @param null|string $method * @param null|string $url * @return string */ protected function _getBaseSignatureString(array $params, $method = null, $url = null) { $encodedParams = array(); foreach ($params as $key => $value) { $encodedParams[HTTPUtility::urlEncode($key)] = HTTPUtility::urlEncode($value); } $baseStrings = array(); if (isset($method)) { $baseStrings[] = strtoupper($method); } if (isset($url)) { // should normalise later $baseStrings[] = HTTPUtility::urlEncode($this->normaliseBaseSignatureUrl($url)); } if (isset($encodedParams['oauth_signature'])) { unset($encodedParams['oauth_signature']); } $baseStrings[] = HTTPUtility::urlEncode($this->_toByteValueOrderedQueryString($encodedParams)); return implode('&', $baseStrings); }