[wp-hackers] Posting HTML formatted content with XML-RPC
Chris Lott
chris.lott at gmail.com
Wed Jan 11 18:20:52 GMT 2006
I tried #wordpress and the forums with no luck so far, so I will ask here:
How can I post an HTML formatted post via the XML-RPC interface? If I
post the HTML code it gets converted to entities. If I preconvert
content to entities, it doesn't get converted back (obviously) :)
I've made this work with a couple of direct db inserts, but XML-RPC
would be much cleaner and not subject to as many changes I would have
to keep up with...
Plain text posts work fine using this code, formatted posts from other
XML-RPC clients work fine.
I am using PHP with the xml-rpc library. Example Code:
$content = "<p><strong>bold Statement</bold></strong>;
$xmlrpcurl = "http://127.0.0.1:2006/devwp/xmlrpc.php";
$client = new xmlrpc_client($xmlrpcurl);
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval("n/a");
$params[] = new xmlrpcval("admin");
$params[] = new xmlrpcval("chrislottt");
$params[] = new xmlrpcval(
"<title>LinkLog</title>".
"<category>2</category>".
$content);
$params[] = new xmlrpcval("true");
$msg = new xmlrpcmsg("blogger.newPost",$params);
c
--
Chris Lott
More information about the wp-hackers
mailing list