當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Publisher::last_response方法代碼示例

本文整理匯總了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;
}
開發者ID:nfiedel,項目名稱:Buzz-to-Blogger,代碼行數:19,代碼來源:pubsubhubbub.php

示例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>";
開發者ID:griffinwebmastar,項目名稱:pubsubhubbub-php,代碼行數:31,代碼來源:publisher_example.php


注:本文中的Publisher::last_response方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。