Posting New Blog entries via XMLRPC in PHP
-
I’ve been hunting unsuccessfully to find a way to post automatically to my wordpress blog using XMLRPC in PHP.
Can anyone point me to a specific working example of using php to take an xml blog post and submit it to a wordpress blog on wordpress.com?
So far every example I have tried utilizing gives me the exact same error message:
“XML-RPC server accepts POST requests only.”
I would appreciate anything that would help point me toward a working solution.
This is an example of one of my previous attempts. This is exactly how I used it except I inserted my actual username and password.
$c = new xmlrpc_client(“/xmlrpc.php”, “dancinandy.wordpress.com”);
$content[‘title’]=”Test Post”;
$content[‘description’]=”This is a test post”;
$content[‘categories’] = array(“frontpage”);
$x = new xmlrpcmsg(“metaWeblog.newPost”,
array(php_xmlrpc_encode(“1”),
php_xmlrpc_encode(“USERNAME”),
php_xmlrpc_encode(“PASSWORD”),
php_xmlrpc_encode($content),
php_xmlrpc_encode(“1”)));$c->return_type = ‘phpvals’;
$r =$c->send($x);
if ($r->errno==”0″)
echo “Successfully Posted”;
else {
echo “There are some error”;
print_r($r);
}
- The topic ‘Posting New Blog entries via XMLRPC in PHP’ is closed to new replies.