Simple way to Ping using Php and XML-RPC
August 11th, 2004
Here are a few easy steps to pinging with XML-RPC with PHP.
1.go to http://keithdevens.com/software/xmlrpc/source and download the xml rpc library
2.save the php file as xmlrpc.inc
3.Paste the code below into your blogging script immediately after a new entry gets added to the database
4.change the url and title to your own site
5.your done!
*If you don’t want the error/confirmation messages, delete all of the foreach loops.
include ‘xmlrpc.inc’;
$method = “weblogUpdates.ping”;
$params = array(XMLRPC_prepare(”YOUR SITE NAME”),XMLRPC_prepare(”http://YOURURL.COM”));
//weblogs.com
$site = “rpc.weblogs.com”;
$location = “/RPC2″;
list($success, $result) = XMLRPC_request( $site, $location, $method, $params );
foreach ( $result as $key => $value ) {
echo(” $key => $value
“.”
“);
}
//technorati.com
$site = “rpc.technorati.com”;
$location = “/rpc/ping”;
list($success, $result) = XMLRPC_request( $site, $location, $method, $params );
foreach ( $result as $key => $value ) {
echo(” $key => $value
“.”
“);
}
//blo.gs
$site = “ping.blo.gs”;
$location = “/”;
list($success, $result) = XMLRPC_request( $site, $location, $method, $params );
foreach ( $result as $key => $value ) {
echo(” $key => $value
“.”
“);
}