Hosting Problems and How to Restore Lost Pings

I just checked in here and found the last couple days of comments missing. Luckily, they were stored in gmail and I think I restored them all. But if you left a comment recently and it isn't here now, it's not that I don't like you (just that my host apparently doesn't like me).

A couple of the comments were pings and I wouldn't have know how to get them back if I hadn't messed around with pinging for my WP_PingPreserver plugin, so I figured it might be useful to put up a quick bit on how to recover lost pings. You'll need to know a little bit about php to use it I guess but if you don't know php and need to restore some pings let me know and I'll make up a quick plugin. So here's some simple (i.e. probably not perfectly to specifications) php code to restore lost pings on WordPress:

PHP:
  1. <?php
  2. $linkingPost='http://LinkingBlog.com/Their-Post-Title/';
  3. $myPost='http://MyBlog.com/My-Post-Title/';
  4. $myBlogHome='http://MyBlog.com';
  5.  
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_URL, $myBlogHome.'/xmlrpc.php');
  8. $data = "<?xml version='1.0'?>
  9. <methodCall>
  10.   <methodName>pingback.ping</methodName>
  11.   <params>
  12.     <param>
  13.         <value>$linkingPost</value>
  14.     </param>
  15.     <param>
  16.         <value>$myPost</value>
  17.     </param>
  18.   </params>
  19. </methodCall>
  20. ";
  21. curl_setopt($ch, CURLOPT_POST, true);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  23. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  24. $output=curl_exec($ch);
  25. curl_close($ch);
  26.  
  27. echo $output;
  28. ?>

It's not very pretty but it gets the job done. Just replace the top three lines with the appropriate links, save it to your host and visit the file in your browser. Hopefully your host won't mysteriously lose your pings but if they do now you know what to do.