I have a custom blogging site, as such I want to create some code that will allow me to pingback other sites that I link to. I have found some code online but cannot get it working! I am using the XMLRPC library and the following code.
When I run this I get headers back and the following error code - I cannot seem to find out what it means!
XML error at line 1, check URLPingback to URL failed with error code 2 message Invalid return payload: enable debugging to examine incoming payload (XML error at line 1, check URL).
require_once "xmlrpc/lib/xmlrpc.inc";
$mypost = "http://www.myurl.com/mypost.html";
$theirpost = "http://theirurl.com/theirpost.php";
$remotexmlrpc = "http://theirurl.com/xmlrpc.php";
$m = new xmlrpcmsg("pingback.ping", array(new xmlrpcval($mypost, "string"), new xmlrpcval($theirpost, "string")));
$c = new xmlrpc_client($remotexmlrpc);
$c->setRequestCompression(null);
$c->setAcceptedCompression(null);
$c->setDebug(1);
$r = $c->send($m);
if (!$r->faultCode()) {
echo "Pingback to $theirpost succeeded.";
} else {
$err = "code " . $r->faultCode() . " message " . $r->faultString();
echo "Pingback to $theirpost failed with error $err.";
}