本文整理汇总了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) {
}
}