本文整理汇总了PHP中Zend_Feed_Pubsubhubbub::getHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed_Pubsubhubbub::getHttpClient方法的具体用法?PHP Zend_Feed_Pubsubhubbub::getHttpClient怎么用?PHP Zend_Feed_Pubsubhubbub::getHttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed_Pubsubhubbub
的用法示例。
在下文中一共展示了Zend_Feed_Pubsubhubbub::getHttpClient方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getHttpClient
/**
* Get a basic prepared HTTP client for use
*
* @param string $mode Must be "subscribe" or "unsubscribe"
* @return Zend_Http_Client
*/
protected function _getHttpClient()
{
$client = Zend_Feed_Pubsubhubbub::getHttpClient();
$client->setMethod(Zend_Http_Client::POST);
$client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' . Zend_Version::VERSION));
return $client;
}
示例2: testCanSetCustomHttpClient
public function testCanSetCustomHttpClient()
{
Zend_Feed_Pubsubhubbub::setHttpClient(new Test_Http_Client_Pubsub());
$this->assertType('Test_Http_Client_Pubsub', Zend_Feed_Pubsubhubbub::getHttpClient());
}
示例3: testNotifiesHubAndReportsFail
public function testNotifiesHubAndReportsFail()
{
Zend_Feed_Pubsubhubbub::setHttpClient(new Zend_Feed_Pubsubhubbub_PublisherTest_ClientFail());
$client = Zend_Feed_Pubsubhubbub::getHttpClient();
$this->_publisher->addHubUrl('http://www.example.com/hub');
$this->_publisher->addUpdatedTopicUrl('http://www.example.com/topic');
$this->_publisher->setParameter('foo', 'bar');
$this->_publisher->notifyAll();
$this->assertFalse($this->_publisher->isSuccess());
}
示例4: _getHttpClient
/**
* Get a basic prepared HTTP client for use
*
* @return Zend_Http_Client
*/
protected function _getHttpClient()
{
$client = Zend_Feed_Pubsubhubbub::getHttpClient();
$client->setMethod(Zend_Http_Client::POST);
$client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION));
$params = array();
$params[] = 'hub.mode=publish';
$topics = $this->getUpdatedTopicUrls();
if (empty($topics)) {
require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' . ' have been set');
}
foreach ($topics as $topicUrl) {
$params[] = 'hub.url=' . urlencode($topicUrl);
}
$optParams = $this->getParameters();
foreach ($optParams as $name => $value) {
$params[] = urlencode($name) . '=' . urlencode($value);
}
$paramString = implode('&', $params);
$client->setRawData($paramString, 'application/x-www-form-urlencoded');
return $client;
}
示例5: testCanSetCustomHttpClient
public function testCanSetCustomHttpClient()
{
Zend_Feed_Pubsubhubbub::setHttpClient(new Test_Http_Client_Pubsub());
$this->assertTrue(Zend_Feed_Pubsubhubbub::getHttpClient() instanceof Test_Http_Client_Pubsub);
}