本文整理匯總了PHP中Varien_Http_Client::setCookie方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Http_Client::setCookie方法的具體用法?PHP Varien_Http_Client::setCookie怎麽用?PHP Varien_Http_Client::setCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Http_Client
的用法示例。
在下文中一共展示了Varien_Http_Client::setCookie方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCrawlerClient
/**
* Get the crawler http client
*
* @return Varien_Http_Client
*/
public function getCrawlerClient()
{
if (is_null($this->_crawlerClient)) {
$this->_crawlerClient = new Varien_Http_Client(null, array('useragent' => sprintf('Nexcessnet_Turpentine/%s Magento/%s Varien_Http_Client', Mage::helper('turpentine/data')->getVersion(), Mage::getVersion()), 'keepalive' => true));
$this->_crawlerClient->setCookie('frontend', 'crawler-session');
}
return $this->_crawlerClient;
}
示例2: customerLogin
public function customerLogin($observer)
{
$cookie = Mage::getSingleton('core/cookie');
if (!Mage::getStoreConfig('subsystem/general/enable') || $cookie->get('magestoreloggedin')) {
return;
}
$customer = $observer['customer'];
// Set loggedin cookie
$path = Mage::getStoreConfig('subsystem/general/path');
$domain = Mage::getStoreConfig('subsystem/general/domain');
$cookie->set('magestoreloggedin', 1, null, $path, $domain);
// Login to Magestore
try {
$url = Mage::getStoreConfig('subsystem/general/account') . 'login';
$client = new Varien_Http_Client($url);
$client->setCookie('frontend', $this->getFrontend());
$client->setParameterPost('pk', self::PK);
$client->setParameterPost('email', $customer->getEmail());
$response = $client->request(Varien_Http_Client::POST);
$cookie->set('frontend', $response->getBody(), null, $path, $domain);
Mage::getSingleton('core/session')->setData('magestore_login', 1);
} catch (Exception $e) {
}
}