Yay! Looks like it's working finally. I at least got a category created. Now to move to the others. Thanks again for the help.<div><br></div><div>For the record, I was right about the struct datatype, just use an array with key=>val pairs like this:</div>
<div><div><br></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>'name'=>$category->name</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>)</div>
<br><div class="gmail_quote">On Tue, Jun 15, 2010 at 1:39 PM, <a href="mailto:eric@eamann.com">eric@eamann.com</a> <span dir="ltr"><<a href="mailto:eric@eamann.com">eric@eamann.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<p style="margin:0px">Tim,</p>
<p style="margin:0px"> </p>
<p style="margin:0px">I haven't worked specifically with struct datatypes (in reality, most of the time I just build my own procedure on the server I'm working with) ... but the documentation says you can use them.</p>
<p style="margin:0px"> </p>
<p style="margin:0px">Here's the full documentation for the IXR library if you want to take a crack at it: <a href="http://scripts.incutio.com/xmlrpc/manual.php" target="_blank">http://scripts.incutio.com/xmlrpc/manual.php</a> Just be sure to post your solution here so we can all learn from you :-)</p>
<p style="margin:0px"> </p><font color="#888888">
<p style="margin:0px">~Eric<span></span></p></font><div><div></div><div class="h5">
<p> </p>
<div style="margin:5px 0px 5px 0px;font-family:monospace">
On June 15, 2010 at 7:20 PM Tim Golen <<a href="mailto:tim@golen.net" target="_blank">tim@golen.net</a>> wrote:<br>
<br>
> Thanks Eric! How did you handle the areguments with struct datatypes like<br>
> for creating a new category? Do you just pass in a array with key=>val pairs<br>
> or do you have to do special encoding?<br>
><br>
> Tim<br>
><br>
> On Tue, Jun 15, 2010 at 1:06 PM, <a href="mailto:eric@eamann.com" target="_blank">eric@eamann.com</a> <<a href="mailto:eric@eamann.com" target="_blank">eric@eamann.com</a>> wrote:<br>
><br>
> > OK, now I understand what you're doing.<br>
> ><br>
> ><br>
> ><br>
> > When I first started working with WordPress and XMLRPC, I tried building my<br>
> > own library ... it was taking a long time, and I ran into many of the issues<br>
> > you're running in to now. Someone suggested I use the built-in IXR library<br>
> > instead, and it made all the difference.<br>
> ><br>
> ><br>
> ><br>
> > Here's a simple example:<br>
> ><br>
> ><br>
> ><br>
> > include_once(ABSPATH . WPINC . '/class-IXR.php');<br>
> ><br>
> ><br>
> ><br>
> > $client = new IXR_Client('destinantion_url');<br>
> ><br>
> ><br>
> ><br>
> > $client->query('<a href="http://procedure.name" target="_blank">procedure.name</a>', 'arg1', 'arg2', 'arg3', ...);<br>
> ><br>
> ><br>
> ><br>
> > $response = $client->getResponse();<br>
> ><br>
> ><br>
> ><br>
> > That will load the library, create a new client pointing at whatever WP<br>
> > installation you're working with, execute your remote procedure, and store<br>
> > the response (errors, data, or whatever) in the $response variable.<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > On June 15, 2010 at 6:51 PM Tim Golen <<a href="mailto:tim@golen.net" target="_blank">tim@golen.net</a>> wrote:<br>
> ><br>
> > > Hi Joseph,<br>
> > ><br>
> > > Right on, that's exactly what I needed to know.<br>
> > ><br>
> > > I've been using <a href="http://devzone.zend.com/article/1307" target="_blank">http://devzone.zend.com/article/1307</a> for the XML-RPC<br>
> > (lower<br>
> > > level) API, and then building my own PHP library on top of that (with the<br>
> > > Wordpress functions). I'll go and check out the IXR library to see if<br>
> > that<br>
> > > helps.<br>
> > ><br>
> > > All of the calls that I am making that pull data from Wordpress are<br>
> > working<br>
> > > fine. It's just when trying to create data (wp.newComment,<br>
> > wp.newCategory,<br>
> > > metaWeblog.newPost) they are all giving me similar data errors:<br>
> > ><br>
> > > Sorry, the new category failed.<br>
> > ><br>
> > > Invalid Data: Please go back and try again.<br>
> > ><br>
> > > Content, title, and excerpt are empty.<br>
> > ><br>
> > > I've been debugging the thing to death and still can't get any closer. I<br>
> > > have a feeling that it has something to do with how the struct datatypes<br>
> > are<br>
> > > being encoded in the XML-RPC portion. Here is a sample of my code:<br>
> > ><br>
> > ><br>
> > > $this->makeRequest(<br>
> > > 'wp.newComment',<br>
> > > array(<br>
> > > new xmlrpcval($blogId),<br>
> > > new xmlrpcval($this->username),<br>
> > > new xmlrpcval($this->password),<br>
> > > new xmlrpcval($postId),<br>
> > > xmlrpc_encode(array(<br>
> > > 'comment_parent'=>intval(0),<br>
> > > 'content'=>strval($comment->content),<br>
> > > 'author'=>strval($comment->author),<br>
> > > 'author_url'=>strval($comment->author_url),<br>
> > > 'author_email'=>strval($comment->author_email)<br>
> > > )),<br>
> > > ));<br>
> > ><br>
> > > The structure containing the comment information ends up being encoded to<br>
> > > this:<br>
> > ><br>
> > > <params><br>
> > > <param><br>
> > > <value><br>
> > > <struct><br>
> > > <member><br>
> > > <name>comment_parent</name><br>
> > > <value><br>
> > > <int>0</int><br>
> > ><br>
> > > </value><br>
> > > </member><br>
> > > <member><br>
> > > <name>content</name><br>
> > > <value><br>
> > > <string>comment</string><br>
> > > </value><br>
> > > </member><br>
> > ><br>
> > > <member><br>
> > > <name>author</name><br>
> > > <value><br>
> > > <string>Tim</string><br>
> > > </value><br>
> > > </member><br>
> > > <member><br>
> > > <name>author_url</name><br>
> > ><br>
> > > <value><br>
> > > <string><a href="http://www.golen.net/blog" target="_blank">http://www.golen.net/blog</a></string><br>
> > > </value><br>
> > > </member><br>
> > > <member><br>
> > > <name>author_email</name><br>
> > > <value><br>
> > > <string><a href="mailto:tim@golen.net" target="_blank">tim@golen.net</a></string><br>
> > ><br>
> > > </value><br>
> > > </member><br>
> > > </struct><br>
> > > </value><br>
> > > </param><br>
> > > </params><br>
> > ><br>
> > ><br>
> > > And all that is encoded the way they discuss it at<br>
> > > <a href="http://devzone.zend.com/article/1307" target="_blank">http://devzone.zend.com/article/1307</a>. I'll take a look at the IXR<br>
> > library<br>
> > > and see if that does any better of a job. I appreciate all of your help<br>
> > and<br>
> > > suggestions with this! Once I get the PHP library built, I think it would<br>
> > be<br>
> > > an invaluable resource to post on the Wordpress site somewhere.<br>
> > ><br>
> > > Tim<br>
> > ><br>
> > > On Tue, Jun 15, 2010 at 12:37 PM, Joseph Scott <<a href="mailto:joseph@josephscott.org" target="_blank">joseph@josephscott.org</a><br>
> > >wrote:<br>
> > ><br>
> > > > 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>
> > > ><br>
> > > > On Tue, Jun 15, 2010 at 11:51 AM, Tim Golen <<a href="mailto:tim@golen.net" target="_blank">tim@golen.net</a>> wrote:<br>
> > > > > Is there already an existing PHP library for the Wordpress API? I'm<br>
> > still<br>
> > > > > running into problems and don't need to reinvent the wheel if it's<br>
> > > > already<br>
> > > > > been done. The MetaWeblog API mentions a PHP library, but it comes up<br>
> > > > 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<br>
> > to<br>
> > > > do<br>
> > > > > something rather simple like create a comment can get really<br>
> > frustrating.<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > --<br>
> > > > Joseph Scott<br>
> > > > <a href="mailto:joseph@josephscott.org" target="_blank">joseph@josephscott.org</a><br>
> > > > <a href="http://josephscott.org/" target="_blank">http://josephscott.org/</a><br>
> > > > _______________________________________________<br>
> > > > wp-xmlrpc mailing list<br>
> > > > <a href="mailto:wp-xmlrpc@lists.automattic.com" target="_blank">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>
> > > ><br>
> ><br>
> > _______________________________________________<br>
> > wp-xmlrpc mailing list<br>
> > <a href="mailto:wp-xmlrpc@lists.automattic.com" target="_blank">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>
> ><br>
> ><br>
</div>
</div></div></div>
<br>_______________________________________________<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>
<br></blockquote></div><br></div>