本文整理汇总了PHP中Varien_Http_Client::setParameterGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Http_Client::setParameterGet方法的具体用法?PHP Varien_Http_Client::setParameterGet怎么用?PHP Varien_Http_Client::setParameterGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Http_Client
的用法示例。
在下文中一共展示了Varien_Http_Client::setParameterGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: license
/**
* license the app
*
*/
public static function license($activationKey, $productToken)
{
$url = 'https://ls.amazonaws.com/';
$client = new Varien_Http_Client($url);
$client->setMethod(Zend_Http_Client::GET);
$client->setParameterGet("Action", "ActivateDesktopProduct");
$client->setParameterGet("ActivationKey", $activationKey);
$client->setParameterGet("ProductToken", $productToken);
$response = $client->request();
if ($response->isSuccessful()) {
$body = $response->getRawBody();
$xml = new SimpleXMLElement($body);
$result = array();
$result["access"] = $xml->ActivateDesktopProductResult->AWSAccessKeyId;
$result["secret"] = $xml->ActivateDesktopProductResult->SecretAccessKey;
$result["usertoken"] = $xml->ActivateDesktopProductResult->UserToken;
// uncomment to debug raw submission response
//Mage::log("result=" . print_r($result,true));
return $result;
} else {
Mage::log("Activation failed to URL: " . $url . ", HTTP response code was not 200");
Mage::log("Raw response: " . print_r($response, true));
return false;
}
}
示例2: request
/**
* Send the HTTP request and return an HTTP response object
*
* @param string $url
* @param Varien_Object $data
* @param string $method
* @return Varien_Object
*/
public function request($url, Varien_Object $data, $method = 'GET')
{
$client = new Varien_Http_Client($url, array('timeout' => 30));
$client->setMethod($method);
if ($method == Zend_Http_Client::POST) {
$client->setParameterPost($this->_parseArray($data));
} else {
$client->setParameterGet($this->_parseArray($data));
}
$response = $client->request();
$body = json_decode($response->getBody(), true);
$result = $this->_parseObject($body);
return $result;
}
示例3: _postRequest
protected function _postRequest($request)
{
$client = new Varien_Http_Client();
$client->setUri($this->getUrl());
$client->setConfig(array('maxredirects' => 2, 'timeout' => 60));
$client->setParameterGet($request);
$client->setMethod(Zend_Http_Client::GET);
try {
$response = $client->request();
} catch (Exception $e) {
Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Gateway request error: %s', $e->getMessage()));
}
$responseBody = $response->getBody();
return $responseBody;
}