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 splash123marketing.wordpress.com.
WordPress.com is an easy way to start blogging. Get a blog, check out our features, read the latest announcements, choose from great themes, or learn about the team behind it.
Need help? Check out our Support site, then
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 splash123marketing.wordpress.com.
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.
<br />
$username = "myusername"; //USED USERNAME NOT EMAIL ADDRESS<br />
$password = "mypassword";<br />
$url = "http://splash123marketing.wordpress.com";</p>
<p>$body = <<<POSTBODY<br />
This is a test post from <a href="$oursitelink">$oursitelink</a>.<br />
<img src="$oursitelink/img/happyface.jpg"><br />
POSTBODY;</p>
<p>$rpcurl = "$url/xmlrpc.php";</p>
<p>$title = htmlentities($title,ENT_NOQUOTES,$encoding);<br />
$keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);<br />
$category = "test,";<br />
$content = array(<br />
'title'=>$title,<br />
'description'=>$body,<br />
'mt_allow_comments'=>0, // 1 to allow comments<br />
'mt_allow_pings'=>0, // 1 to allow trackbacks<br />
'post_type'=>'post',<br />
'mt_keywords'=>$keywords,<br />
'categories'=>array($category),<br />
);<br />
//======================================CREATE NEW CATEGORY<br />
$myCat = array(<br />
'name' => $category,<br />
'slug' => $category,<br />
'parent_id' => 0,<br />
'description' => 'test',<br />
);</p>
<p>$paramscat = array(0,$username,$password,$myCat,true);<br />
$request = xmlrpc_encode_request('wp.newCategory',$paramscat);<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);<br />
curl_setopt($ch, CURLOPT_URL, $rpcurl);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 1);<br />
$results = curl_exec($ch);<br />
curl_close($ch);<br />
//echo $results;</p>
<p>//=======================================MAKE POSTS=====<br />
$results = "";<br />
$params = array(0,$username,$password,$content,true);<br />
$request = xmlrpc_encode_request('metaWeblog.newPost',$params);<br />
$ch = curl_init();<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);<br />
curl_setopt($ch, CURLOPT_URL, $rpcurl);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);<br />
//curl_setopt($ch, CURLOPT_HEADER, 1);<br />
curl_setopt($ch, CURLOPT_TIMEOUT, 1);<br />
$results = curl_exec($ch);<br />
curl_close($ch);<br />
echo $results;<br />
Kathryn really appreciate your help! Thanks!
Thanks for the code. I'll keep you posted.
Hi splash123com,
I've replied to you privately. Please look for an email from support@wordpress.com
Thanks.
This topic has been closed to new replies.