[wp-xmlrpc] wp.newPage

Joseph Scott joseph at randomnetworks.com
Mon Dec 29 17:37:33 GMT 2008


On Dec 26, 2008, at 9:12 PM, Patrick Carlow wrote:

> Hello,
>
> Sorry if this isn’t the right place for this, but I’m having a lot  
> of trouble trying to get wp.newPage to work using a PHP script.
>
> wp.getPageList works as expected, but wp.newPage returns the error:  
> faultCode  401    faultString  Invalid post type
>
> I don’t see anything in the doc that shows an option to set the post  
> type.


It would be helpful to see the script to get an idea of what's wrong.   
Here's a simple test script I use for wp.newPage with out any problems:

<?php
require "./IXR_Library.inc.php";
$method_name = "wp.newPage";

$rpc_url = "http://localhost/~joseph/wp/trunk/xmlrpc.php";
$blog_id    = 1;
$username   = "username";
$password   = "password";
$publish    = false;

$post = array(
     "title"         => "New Page Test",
     "description"   => "Hello there, this is a test."
);


$rpc = new IXR_Client( $rpc_url );
$status = $rpc->query(
     $method_name,
     $blog_id,
     $username,
     $password,
     $post,
     $publish
);

if( !$status ) {
     print "Error in RPC request\n";
     print_r( $rpc );
     exit;
}

print_r( $rpc->getResponse( ) );
print "\n";


--
Joseph Scott
joseph at josephscott.org
http://josephscott.org/




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-xmlrpc/attachments/20081229/92882230/attachment.htm


More information about the wp-xmlrpc mailing list