Ping Service, blog program provides a notification mechanism for the first time to post updates to the blog to provide ping service services site, write the aggregation of the time studied
Look at the standard first.
This is a standard ping Service, with XMLRPC to pass the data, comments written in such detail, the code instructions do not need it, PHP5 open Xmlrpc method
client.php
<?php
$host = ' ZXSV ';
$port = 80;
$rpc _server = '/test/xmlrpc_server.php ';
$title = ' ZXSV ';
$server = ' http://zxsv/test/';
$rss = ' http://zxsv/test/rss.php ';
Weblogupdates.ping method
$Ping = xmlrpc_encode_request (' weblogupdates.ping ', Array ($title, $server));
Weblogupdates.extendedping method
$extendedPing = xmlrpc_encode_request (' weblogupdates.extendedping ', Array ($title, $server, $rss));
Call the Rpc_client_call function to send all requests to the XML-RPC server to get information
$response = Rpc_client_call ($host, $port, $rpc _server, $Ping);
$split = ' <?xml version= ' 1.0 ' encoding= ' iso-8859-1 '?> ';
$xml = Explode ($split, $response);
$xml = $split. Array_pop ($xml);
$response = Xmlrpc_decode ($xml);
Output information obtained from the RPC server side
Print_r ($response);
/**
* Functions: Functions provided to clients to connect XML-RPC server-side
Parameters
* $host hosts that need to be connected
* $port Port connecting the host
* $RPC _server XML-RPC server-side files
* $request encapsulated XML Request information
* Return: The connection successfully returned the XML information returned by the server side and failed to return false
*/
function Rpc_client_call ($host, $port, $rpc _server, $request) {
$fp = Fsockopen ($host, $port);
$query = "POST $rpc _server http/1.0\nuser_agent:xml-rpc client\nhost:". $host. " \ncontent-type:text/xml\ncontent-length: ". strlen ($request)." \ n ". $request." \ n ";
if (!fputs ($fp, $query, strlen ($query)) {
$ERRSTR = "Write error";
return false;
}
$contents = ';
while (!feof ($fp)) {
$contents. = Fgets ($FP);
}
Fclose ($FP);
return $contents;
}
?>