PHP & the XML_RPC ping


Ok, I have this PHP script that I downloaded somewhere, I forget where, and it was written to ping I was able to modify it to also ping blogrolling, but I couldn’t get it to ping Then I found Ping-O-Matic on scriptygoddess. If I can get the script to just ping them, then I will be pinging many services all at once and not have to configure the script for each one.

The problem is, I am not even sure if it is working.

The only info Ping-O-Matic gives is the url to ping:

Here is my code:

[code]$default_name = “#!/usr/bin/mom”;
$default_url = “”;

function pingWeblogs($name="", $url="") {
global $default_name, $default_url;

if (!$name) $name = $default_name;
if (!$url)  $url  = $default_url;  

$fp = fsockopen("", 80, &$errnum, &$errstr);

if(!$fp) {
  echo "$errstr ($errnum)<br>n";
  $output = "ERROR!";
} else  {
  $len = strlen($name) + strlen($url) + strlen("<?xml version="1.0"?><methodCall><methodName></methodName><params><param><value></value></param><param><value></value></param></params></methodCall>");
  fputs($fp,"POST /RPC2 HTTP/1.0rn");
  fputs($fp,"User-Agent: Bean's Updater (PHP Stylin')rn");
  fputs($fp,"Content-Type: text/xmlrn");
  fputs($fp,"Content-length: $lenrnrn");
  fputs($fp,"<?xml version="1.0"?><methodCall><methodName></methodName><params><param><value>$name</value></param><param><value>$url</value></param></params></methodCall>");
  while(!feof($fp)) $output.=fgets($fp,4096);

$output = preg_replace("/.*</boolean>/si","",$output);
$output = preg_replace("/.*<value>/si","",$output);
$output = preg_replace("/</value>.*/si","",$output);    
return $output;


All I changed was the url to ping. This is what it returns:

23 May 2004, 22:58:31 -- HTTP/1.1 200 OK Date: Mon, 24 May 2004 03:59:16 GMT Server: Apache/1.3.29 (Unix) mod_auth_passthrough/1.8 mod_gzip/ mod_log_bytes/1.2 mod_bwlimited/1.4 Vary: Accept-Encoding Connection: close Content-Type: text/html

I have no idea what that is. Did it ping? Help?


don’t take this as gospel but I beleive that it is working. I think it is returning a code 200 to you. Hope someone can give you a more definitive answer.


I got it working, thanks.

Michelle Potter, wife to Mark and mom to Aryanna, Aoghdan, Seamus & Hamish
The Mommy Database –
#!/usr/bin/mom –

have you any idea how many children it takes to turn off one light in the kitchen? three. it takes one to say, “what light?” and two more to say, “i didn’t turn it on.”
– erma bombeck