Home > PHP > Zend_XmlRpc_Request_Http で更新pingの受信

Zend_XmlRpc_Request_Http で更新pingの受信

  • 2007-11-26 (月) 13:00
  • PHP

すごいね。Zend Framework !

下記を記述するだけで、weblogUpdates.ping を受信できちゃう。あとは、データをそれなりに加工してSQL等に保存すればいいのだ。

require_once 'Zend/XmlRpc/Request/Http.php';
$request = new Zend_XmlRpc_Request_Http();

$method = $request->getMethod();
if ($method != "weblogUpdates.ping"
    AND $method != "weblogUpdates.extendedPing") :
    exit();
endif;

$params = array();
$params = $request->getParams();
if (!$params[0] OR !$params[1]) :
    exit();
endif;

require_once 'Zend/Uri.php';
if (!Zend_Uri::check($params[1])) :
    exit();
endif;

$result["method"]    = $method;
$result["title"]         = htmlspecialchars($params[0]);
$result["url"]           = $params[1];
$result["userAgent"] = htmlspecialchars($_SERVER["HTTP_USER_AGENT"]);
$result["params"]     = serialize($params);

$otherUrlArray = array();
foreach ($params as $param) :
    if (Zend_Uri::check($param) AND $param != $result["url"]) :
        $otherUrlArray[] = $param;
    endif;
endforeach;
if (count($otherUrlArray) > 0) :
    $result["otherUrl"] = implode(", ", $otherUrlArray);
else :
    $result["otherUrl"] = null;
endif;

//最後にSQLなどで $result を保存!

Comments:0

Comment Form
Remember personal info

Trackback+Pingback:0

TrackBack URL for this entry
http://www3.us/2007/11/26/zend_xmlrpc_request_http-%e3%81%a7%e6%9b%b4%e6%96%b0ping%e3%81%ae%e5%8f%97%e4%bf%a1/trackback/
Listed below are links to weblogs that reference
Zend_XmlRpc_Request_Http で更新pingの受信 from nnpooh の :: ひとり言 ::

Home > PHP > Zend_XmlRpc_Request_Http で更新pingの受信

Links
Search
Feeds

Page Top