Posting Via XMLRPC Not Working – FaultCode 500
-
Just made a new wordpress blog and wanted to post to it via XMLRPC but any test I did does not work.
Any info you need I’d be glad to share, any help you can provide would rock!
The blog I need help with is: (visible only to logged in users)
-
Thanks for making a separate post. Could you please let me know by what means you’re using XML-RPC to post to the site? The more detail we have, the better. Thanks for your help.
-
Hi Kathryn,
Here is the php code I”m using to post the xmlrpc.
$username = "myusername"; //USED USERNAME NOT EMAIL ADDRESS
$password = "mypassword";
$url = "http://splash123marketing.wordpress.com";$body = <<<POSTBODY
This is a test post from $oursitelink.
<img src="$oursitelink/img/happyface.jpg">
POSTBODY;$rpcurl = "$url/xmlrpc.php";
$title = htmlentities($title,ENT_NOQUOTES,$encoding);
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
$category = "test,";
$content = array(
'title'=>$title,
'description'=>$body,
'mt_allow_comments'=>0, // 1 to allow comments
'mt_allow_pings'=>0, // 1 to allow trackbacks
'post_type'=>'post',
'mt_keywords'=>$keywords,
'categories'=>array($category),
);
//======================================CREATE NEW CATEGORY
$myCat = array(
'name' => $category,
'slug' => $category,
'parent_id' => 0,
'description' => 'test',
);$paramscat = array(0,$username,$password,$myCat,true);
$request = xmlrpc_encode_request('wp.newCategory',$paramscat);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$results = curl_exec($ch);
curl_close($ch);
//echo $results;//=======================================MAKE POSTS=====
$results = "";
$params = array(0,$username,$password,$content,true);
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$results = curl_exec($ch);
curl_close($ch);
echo $results;Kathryn really appreciate your help! Thanks!
-
-
Hi splash123com,
I’ve replied to you privately. Please look for an email from support@wordpress.com
Thanks.
- The topic ‘Posting Via XMLRPC Not Working – FaultCode 500’ is closed to new replies.