• Hi,

    Please help with this. I am trying to use the XMLRPC to create a post, but cannot figure out how to pass a “dateCreated”.

    I.e.,

    $content[‘date_created_gmt’] = date(“Ydm”);
    or
    $content[‘postDate’] = date(“Ydm”);
    $client->query(‘metaWebLog.newPost’…etc,etc)

    Basically, if I try executing that, I get this error (it is calling the xmlrpc.php installed by default in wordpress)

    “An error occured – 32700: parse error, not well formed”

    Any help would be GREATLY appreciated.

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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> (https://www.xmlrpc.com/spec)
    – The method name is metaWeblog.newPost (note the character case)

    Thread Starter wordpresshelp111

    (@wordpresshelp111)

    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 (https://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.

    Thread Starter wordpresshelp111

    (@wordpresshelp111)

    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:

    https://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 https://www.ads-software.com/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 !

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Please help/Getting Date’ is closed to new replies.