So I wanted to ping Feedburner's server to immediately read my feed and update my Twitter account, but unlike the more modern PubsubHubbub spec, the current weblog ping servers out there all use XML-RPC, which is sort of outmoded in terms of web standards. I honestly thought they would have added a simple GET service in by now, but apparently not.
Anyways, I only wanted to make the ping a small addition to my current blogging software and didn't feel like adding a whole XML-RPC library (like you can find here), nor did I want to depend on PHP's included-sometimes-if-you-compile-it xmlrpc functions. But looking out on the web turned out zero examples of just pinging a server with just curl (or none that I could find at any rate).
So after getting the ping working using a library, I dumped out the request to see what was happening, and then duplicated it in plain text using curl. Works like a charm (at least on ping.feedburner.com), and has no dependencies.
Here's the code in case it's useful to you:
$weblog_name = 'Russell Beattie Weblog'; $weblog_url = 'http://feeds.feedburner.com/RussellBeattieWeblog'; $ping_url = 'http://ping.feedburner.com'; $request = <<<EOT <?xml version="1.0" encoding="iso-8859-1"?> <methodCall> <methodName>weblogUpdates.ping</methodName> <params> <param> <value> <string>$weblog_name</string> </value> </param> <param> <value> <string>$weblog_url</string> </value> </param> </params> </methodCall> EOT; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $ping_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt($ch, CURLOPT_POST, true ); curl_setopt($ch, CURLOPT_POSTFIELDS, trim($request)); $result = curl_exec($ch); curl_close($ch);
I'll let you go ahead and make a function out of it by yourself, I just threw it inline with my blog post method, so I didn't care. :-)
Hope that helps someone someday!