Support » Fixing WordPress » posting via xmlrpc metaWeblog -> error in xmlrpc.php

  • hello,

    tried to submit a new post to my blog with metaWeblog API without success. It works with blogger API but unfortunately it dosen’t support pubDate

    Here’s the error msg:

    Fatal error: Call to a member function getIso() on a non-object in /.../wp/xmlrpc.php on line 548

    my struct:

    <title>TEST 1</title>
    <description>this is a test post</description>
    <category>cat1</category>
    <dateCreated>20070512T15:19:21+0000</dateCreated>

    I tried all possible versions of isodate, but I get always the same error. even if I omit dateCreated???

    Any help on this?

    Thanks and regards

    ezey

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was having the same problem, but I patched the xmlrpc.php file to fix it. Go to the line number in xmlrpc.php that the error is indicating. You should see some code that looks similar to this (depending on your WordPress version):

    // Do some timestamp voodoo
    $dateCreatedd = $content_struct['dateCreated'];
    if (!empty($dateCreatedd)) {
        $dateCreated = $dateCreatedd->getIso();
        $post_date     = get_date_from_gmt(iso8601_to_datetime($dateCreated));
        $post_date_gmt = iso8601_to_datetime($dateCreated. "Z", GMT);
    } else {
        $post_date     = current_time('mysql');
        $post_date_gmt = current_time('mysql', 1);
    }

    Modify your source to look like the following:

    // Do some timestamp voodoo
    $dateCreatedd = $content_struct['dateCreated'];
    if (!empty($dateCreatedd)) {
        $dateIXR = new IXR_Date($dateCreatedd);
        $dateCreated = $dateIXR->getIso();
        $post_date     = get_date_from_gmt(iso8601_to_datetime($dateCreated));
        $post_date_gmt = iso8601_to_datetime($dateCreated. "Z", GMT);
    } else {
        $post_date     = current_time('mysql');
        $post_date_gmt = current_time('mysql', 1);
    }

    You see the problem lies in the fact that the original code is trying to call the getIso() on a string, which is definitely not an IXR_Date class. So I just modified it to create the IXR_Date class before calling that method and it works fine.

    this fix sets the dates of my posts to 12/31/69

    nada

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘posting via xmlrpc metaWeblog -> error in xmlrpc.php’ is closed to new replies.