jdav357
asked on
Wordpress API - add new page through Code igniter XML-RPC
Hi I am trying to write an application to allow me to update my wordpress blog through codeigniter's XML RPC.
[code]
[code]
This is the code for adding the new page in my class:
class wordpress extends CI_xmlrpc{
...code for username etc..
function newPage($content){
$this->method('wp.newPage');
$request = array($this->blog_id, $this->username, $this->password, $content);
$this->request($request);
if ( ! $this->send_request()){
return $this->display_error();
}
else{
return $this->display_response();
}
}
}
This is the code for getting the data from the user:
form_open('media/wordpressAdd','id="wordpressForm"').
form_input('post[title]').
form_textarea('post[description]').
form_hidden('post[publish]','1').
form_submit('publish', 'Publish').
form_close();
This is the snippet of code for putting the posted data into the above function:
if($this->input->post('post')){
$worked=$this->wordpress->newPage($this->input->post('post'));
print $worked;
$page['page']['heading']="Page Published";
$page['page']['content']="";
}
The response I get from Wordpress is:
Invalid post type.
I suspect it is something to do with using the array got from the post and passing that in to wordpress (http://codex.wordpress.org/XML-RPC_wp#Parameters_16):
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
ASKER