[wp-xmlrpc] Problems with dateCreated in metaWeblog.newPost/editPost - dateTime.iso8601

Daniel Jalkut jalkut at red-sweater.com
Fri Oct 30 16:24:17 UTC 2009


Hi AJ, you should post a copy of what the actual XML cargo looks like  
that gets sent over the network.  Otherwise it's harder for the folks  
on this list to speculate what might be wrong.

For your reference, here is an example of a properly formatted  
dateTime parameter that works:

			<name>dateCreated</name>
			<value><dateTime.iso8601>20091029T16:23:02Z</dateTime.iso8601></ 
value>
			</member>

When in doubt about these types of things, a great approach is to find  
a client that works, and monitor what it sends over the network, to  
see what you need to mimic.

Daniel

On Oct 30, 2009, at 12:17pm, AJ Cerqueti wrote:

> Hi,
>
> This has clearly been discussed before: http://comox.textdrive.com/pipermail/wp-xmlrpc/2008-April/000188.html
>
> If dateCreated is of PHP type DateTime, posting will succeed, when  
> it's a string in ISO8601 format it fails.
> However, no matter what date the DateTime object contains, it  
> doesn't seem to pass the timestamp.
>
> E.g.
>
> $title = htmlentities($title,ENT_NOQUOTES,$encoding);
> $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);
> $datetime = new DateTime('2008-08-03 14:52:10');
> echo "Formatted ISO: " . $datetime->format(DATE_ISO8601) . "<br />\n";
> var_dump($datetime);
>
> $content = array(
> 'title'=>$title,
> 'description'=>$body,
> 'dateCreated' => $datetime,
> 'mt_allow_comments'=>1,
> 'mt_allow_pings'=>1,
> 'post_type'=>'post',
> 'mt_keywords'=>$keywords,
> 'categories'=>array($category));
>
> Will post, but date will be current time.
>
> Any ideas?
>
> Cheers,
>
> AJ
>
>
> _______________________________________________
> wp-xmlrpc mailing list
> wp-xmlrpc at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-xmlrpc



More information about the wp-xmlrpc mailing list