本文整理汇总了PHP中Publisher::last_response方法的典型用法代码示例。如果您正苦于以下问题:PHP Publisher::last_response方法的具体用法?PHP Publisher::last_response怎么用?PHP Publisher::last_response使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::last_response方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: publish_to_hub
function publish_to_hub($post_id)
{
// we want to notify the hub for every feed
$feed_urls = array();
$feed_urls[] = get_bloginfo('atom_url');
$feed_urls[] = get_bloginfo('rss_url');
$feed_urls[] = get_bloginfo('rdf_url');
$feed_urls[] = get_bloginfo('rss2_url');
// remove dups (ie. they all point to feedburner)
$feed_urls = array_unique($feed_urls);
// get the address of the publish endpoint on the hub
$hub_url = get_pubsub_endpoint();
$p = new Publisher($hub_url);
// need better error handling
if (!$p->publish_update($feed_urls, "http_post_wp")) {
print_r($p->last_response());
}
return $post_id;
}
示例2: Publisher
// process form
if ($_POST['sub']) {
$hub_url = $_POST['hub_url'];
$topic_url = $_POST['topic_url'];
// check that a hub url is specified
if (!$hub_url) {
echo "Please specify a hub url.<br /><br /><a href='publisher_example.php'>back</a>";
exit;
}
// check that a topic url is specified
if (!$topic_url) {
echo "Please specify a topic url to publish.<br /><br /><a href='publisher_example.php'>back</a>";
exit;
}
// $hub_url = "http://pubsubhubbub.appspot.com/publish";
$p = new Publisher($hub_url);
if ($p->publish_update($topic_url)) {
echo "<i>{$topic_url}</i> was successfully published to <i>{$hub_url}</i><br /><br /><a href='publisher_example.php'>back</a>";
} else {
echo "ooops...";
print_r($p->last_response());
}
} else {
// display a primitive form for testing
echo "<form action='publisher_example.php' method='POST'>";
echo "hub url: <input name='hub_url' type='text' value='http://pubsubhubbub.appspot.com/publish' size='50'/><br />";
echo "topic url: <input name='topic_url' type='text' value='http://www.onlineaspect.com' size='50' /><br />";
echo "<input name='sub' type='submit' value='Publish' /><br />";
echo "</form>";
}
echo "</center>";