Hi Joseph,<div><br></div><div>Right on, that's exactly what I needed to know.</div><div><br></div><div>I've been using <a href="http://devzone.zend.com/article/1307">http://devzone.zend.com/article/1307</a> for the XML-RPC (lower level) API, and then building my own PHP library on top of that (with the Wordpress functions). I'll go and check out the IXR library to see if that helps.</div>
<div><br></div><div>All of the calls that I am making that pull data from Wordpress are working fine. It's just when trying to create data (wp.newComment, wp.newCategory, metaWeblog.newPost) they are all giving me similar data errors:</div>
<div><pre>Sorry, the new category failed.</pre><pre><pre>Invalid Data: Please go back and try again.</pre><pre><pre>Content, title, and excerpt are empty.</pre></pre></pre>I've been debugging the thing to death and still can't get any closer. I have a feeling that it has something to do with how the struct datatypes are being encoded in the XML-RPC portion. Here is a sample of my code:</div>
<div><br></div><div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$this->makeRequest(</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>'wp.newComment',</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>array(</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>new xmlrpcval($blogId),</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>new xmlrpcval($this->username),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>new xmlrpcval($this->password),</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>new xmlrpcval($postId),</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>xmlrpc_encode(array(</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>'comment_parent'=>intval(0),</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>'content'=>strval($comment->content),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>'author'=>strval($comment->author),</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>'author_url'=>strval($comment->author_url),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>'author_email'=>strval($comment->author_email)</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>)),</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>));</div>
<div><br></div><div>The structure containing the comment information ends up being encoded to this:</div><div><pre id="line1"><<span class="start-tag">params</span>>
<<span class="start-tag">param</span>>
<<span class="start-tag">value</span>>
<<span class="start-tag">struct</span>>
<<span class="start-tag">member</span>>
<<span class="start-tag">name</span>>comment_parent</<span class="end-tag">name</span>>
<<span class="start-tag">value</span>>
<<span class="start-tag">int</span>>0</<span class="end-tag">int</span>>
</pre><pre id="line10"> </<span class="end-tag">value</span>>
</<span class="end-tag">member</span>>
<<span class="start-tag">member</span>>
<<span class="start-tag">name</span>>content</<span class="end-tag">name</span>>
<<span class="start-tag">value</span>>
<<span class="start-tag">string</span>>comment</<span class="end-tag">string</span>>
</<span class="end-tag">value</span>>
</<span class="end-tag">member</span>>
</pre><pre id="line18"> <<span class="start-tag">member</span>>
<<span class="start-tag">name</span>>author</<span class="end-tag">name</span>>
<<span class="start-tag">value</span>>
<<span class="start-tag">string</span>>Tim</<span class="end-tag">string</span>>
</<span class="end-tag">value</span>>
</<span class="end-tag">member</span>>
<<span class="start-tag">member</span>>
<<span class="start-tag">name</span>>author_url</<span class="end-tag">name</span>>
</pre><pre id="line26"> <<span class="start-tag">value</span>>
<<span class="start-tag">string</span>><a href="http://www.golen.net/blog">http://www.golen.net/blog</a></<span class="end-tag">string</span>>
</<span class="end-tag">value</span>>
</<span class="end-tag">member</span>>
<<span class="start-tag">member</span>>
<<span class="start-tag">name</span>>author_email</<span class="end-tag">name</span>>
<<span class="start-tag">value</span>>
<<span class="start-tag">string</span>><a href="mailto:tim@golen.net">tim@golen.net</a></<span class="end-tag">string</span>>
</pre><pre id="line34"> </<span class="end-tag">value</span>>
</<span class="end-tag">member</span>>
</<span class="end-tag">struct</span>>
</<span class="end-tag">value</span>>
</<span class="end-tag">param</span>>
</<span class="end-tag">params</span>>
</pre></div><div><br></div><div>And all that is encoded the way they discuss it at <a href="http://devzone.zend.com/article/1307">http://devzone.zend.com/article/1307</a>. I'll take a look at the IXR library and see if that does any better of a job. I appreciate all of your help and suggestions with this! Once I get the PHP library built, I think it would be an invaluable resource to post on the Wordpress site somewhere.</div>
<div><br></div><div>Tim </div><div><br></div><div class="gmail_quote">On Tue, Jun 15, 2010 at 12:37 PM, Joseph Scott <span dir="ltr"><<a href="mailto:joseph@josephscott.org">joseph@josephscott.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">There are 2 different "levels" of libraries for the the WP XML-RPC<br>
APIs. First, lower level XML-RPC only APIs. These take care of all<br>
the XML-RPC work, but don't know anything about the specific methods<br>
that WordPress provides. For that layer I recommend the PHP IXR<br>
library, which is what WordPress uses.<br>
<br>
The next level up are libraries both take care of the XML-RPC details<br>
and know about the various methods that WP exposes. I've seen some<br>
Perl libraries that fit into this category, but I haven't seen much in<br>
the of PHP ones.<br>
<div><div></div><div class="h5"><br>
On Tue, Jun 15, 2010 at 11:51 AM, Tim Golen <<a href="mailto:tim@golen.net">tim@golen.net</a>> wrote:<br>
> Is there already an existing PHP library for the Wordpress API? I'm still<br>
> running into problems and don't need to reinvent the wheel if it's already<br>
> been done. The MetaWeblog API mentions a PHP library, but it comes up with a<br>
> 404 error, and the MetaWeblog site hasn't been updated since 2003.<br>
> Errors like "Invalid Data: Please go back and try again." when trying to do<br>
> something rather simple like create a comment can get really frustrating.<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Joseph Scott<br>
<a href="mailto:joseph@josephscott.org">joseph@josephscott.org</a><br>
<a href="http://josephscott.org/" target="_blank">http://josephscott.org/</a><br>
</font><div><div></div><div class="h5">_______________________________________________<br>
wp-xmlrpc mailing list<br>
<a href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a><br>
<a href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc" target="_blank">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a><br>
</div></div></blockquote></div><br></div>