Hard to tell exactly what the parse error was without seeing the raw XML, but a few things to note:
– Highly recommend using the date_created_gmt field, which is by definition always GMT.
– Remember that date fields are <dateTime.iso8601> (http://www.xmlrpc.com/spec)
– The method name is metaWeblog.newPost (note the character case)
Ok…
How do I format the date field correctly then?
I am trying to use:
$content[“date_created_gmt”]=’2010-08-08 00:00:00′
as a test, and it doesn’t work. I have tried sticking a ‘gmdate(…)’ in front of that, still doesn’t work.
All my other fields (so far) work ok if I make changes, so no idea about this. I have tried “manually” making a iso8601 string, but that doesn’t work either.
Is there some ‘special’ wordpress way of formatting a date? As it is, I am having to manually rewrite this via SQL…
If you are using the IXR XML-RPC library (http://scripts.incutio.com/xmlrpc/), which is the one that WordPress ships with and uses, then you’ll need to call IXR_Date class. Something like this:
$content['date_created_gmt'] = new IXR_Date( $post_date_time );
This allows will make the contents of that field use the dateTime.iso8601 XML-RPC data type.
Totally off-topic comment. I read the title of this post as “please help getting a date.” Thought I had wandered into an internet dating forum. =D
Ok, carry on.
Hi j. scott,
Thanks!! That did the trick… How did you figure that out/know about it? Have you just done a lot of xmlrpc work? (I tried searching the wordpress docs, probably spent about 4-5 hours just to find *one* line of code :P)
Where would you recommend further reading? (for anything xmlrpc related, but helping with wordpress?)
Thanks very much! 🙂
I do a fair bit of XML-RPC work on WP. There’s an email list:
http://lists.automattic.com/mailman/listinfo/wp-xmlrpc
Which is good to join if you are going to be doing WP XML-RPC (or AtomPub) work. If xmlrpc.com comes back again there was a fair bit of content on there (seems to be gone/down right now). I believe there are a few books around as well.
Hi Scott,
Would IXR XML-RPC library the best to use for xmlrpc ?
I am struggling to encode
dateCreated in ISO in php using date(“c”) etc, I am thinking of using a library to make life easier.
BTW, I read your reply on http://wordpress.org/support/topic/330597
Thanks for any advice.
I like the IXR library.
For date fields, make sure you are setting the field as a date type in the XML-RPC request.
Thanks I am using IXR now and it’s much easier !