Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要一个显示如何使用Codeigniter发布到Wordpress的代码示例吗_Wordpress_Codeigniter_Xml Rpc - Fatal编程技术网

需要一个显示如何使用Codeigniter发布到Wordpress的代码示例吗

需要一个显示如何使用Codeigniter发布到Wordpress的代码示例吗,wordpress,codeigniter,xml-rpc,Wordpress,Codeigniter,Xml Rpc,有没有人可以分享一个代码示例,演示如何使用CodeIgniter xml rpc库向Wordpress发布基本的博客文章 到目前为止,我有这个,这总是导致“坏登录/通过组合”,虽然我使用的是正确的组合 function doPost(){ $this->load->library('xmlrpc'); $bloguser = "theUserid"; $blogpass = "thePassword"; $blogid = 0; //I've tr

有没有人可以分享一个代码示例,演示如何使用CodeIgniter xml rpc库向Wordpress发布基本的博客文章

到目前为止,我有这个,这总是导致“坏登录/通过组合”,虽然我使用的是正确的组合

function doPost(){

    $this->load->library('xmlrpc');

    $bloguser = "theUserid";
    $blogpass = "thePassword";
    $blogid = 0; //I've tried 0 and 1 here. 
    $post['title'] = "The title of a new post";
    $post['description'] = "The body of the post.";
    $this->xmlrpc->server("http://localhost/blog/xmlrpc.php", 80);
    $this->xmlrpc->method('metaWeblog.newPost');

    $this->xmlrpc->request = array($blogid, $bloguser, $blogpass, $post, TRUE);
    if ( ! $this->xmlrpc->send_request())
    {
        echo $this->xmlrpc->display_error();
    }
    else
    {
        echo '<pre>';
        print_r($this->xmlrpc->display_response());
        echo '</pre>';
    }
}
函数doPost(){
$this->load->library('xmlrpc');
$bloguser=“theUserid”;
$blogpass=“thePassword”;
$blogid=0;//我在这里尝试了0和1。
$post['title']=“新帖子的标题”;
$post['description']=“文章的正文。”;
$this->xmlrpc->server(“http://localhost/blog/xmlrpc.php", 80);
$this->xmlrpc->method('metaWeblog.newPost');
$this->xmlrpc->request=array($blogid、$bloguser、$blogpass、$post,TRUE);
如果(!$this->xmlrpc->send_request())
{
echo$this->xmlrpc->display_error();
}
其他的
{
回声';
function doPost(){

    $this->load->library('xmlrpc');

    $bloguser = "theUserID";
    $blogpass = "thePassword";
    $blogid = 1; 
    $publishImmediately = TRUE;

    $thePost = array(array('title'  => array('this is the title','string'),
                            'description'    => array('this is the description','string')
                            ),
                     'struct');               


    $myPost = "my post";
    //$this->xmlrpc->set_debug(TRUE);
    $this->xmlrpc->server("http://url.to/xmlrpc.php", 80);
    $this->xmlrpc->method('metaWeblog.newPost');

    $request = array($blogid, $bloguser, $blogpass, $thePost, $publishImmediately);

    $this->xmlrpc->request($request);
    $result = $this->xmlrpc->send_request();

    if ( !$result )
    {
        echo $this->xmlrpc->display_error();
    }
    else
    {
        echo '<pre>';
        print_r($this->xmlrpc->display_response());
        echo '</pre>';
    }
}
打印($this->xmlrpc->display_response()); 回声';
function doPost(){

    $this->load->library('xmlrpc');

    $bloguser = "theUserID";
    $blogpass = "thePassword";
    $blogid = 1; 
    $publishImmediately = TRUE;

    $thePost = array(array('title'  => array('this is the title','string'),
                            'description'    => array('this is the description','string')
                            ),
                     'struct');               


    $myPost = "my post";
    //$this->xmlrpc->set_debug(TRUE);
    $this->xmlrpc->server("http://url.to/xmlrpc.php", 80);
    $this->xmlrpc->method('metaWeblog.newPost');

    $request = array($blogid, $bloguser, $blogpass, $thePost, $publishImmediately);

    $this->xmlrpc->request($request);
    $result = $this->xmlrpc->send_request();

    if ( !$result )
    {
        echo $this->xmlrpc->display_error();
    }
    else
    {
        echo '<pre>';
        print_r($this->xmlrpc->display_response());
        echo '</pre>';
    }
}
} }
在咬牙切齿之后,这似乎有效:

函数doPost(){
$this->load->library('xmlrpc');
$bloguser=“theUserID”;
$blogpass=“thePassword”;
$blogid=1;
$PublishInstant=TRUE;
$thePost=array(数组('title'=>array('this the title','string'),
'description'=>array('这是说明','string')
),
“struct”);
$myPost=“我的帖子”;
//$this->xmlrpc->set_debug(TRUE);
$this->xmlrpc->server(“http://url.to/xmlrpc.php", 80);
$this->xmlrpc->method('metaWeblog.newPost');
$request=array($blogid、$bloguser、$blogpass、$thePost、$publishinstallent);
$this->xmlrpc->request($request);
$result=$this->xmlrpc->send_request();
如果(!$result)
{
echo$this->xmlrpc->display_error();
}
其他的
{
回声';
function doPost(){

    $this->load->library('xmlrpc');

    $bloguser = "theUserID";
    $blogpass = "thePassword";
    $blogid = 1; 
    $publishImmediately = TRUE;

    $thePost = array(array('title'  => array('this is the title','string'),
                            'description'    => array('this is the description','string')
                            ),
                     'struct');               


    $myPost = "my post";
    //$this->xmlrpc->set_debug(TRUE);
    $this->xmlrpc->server("http://url.to/xmlrpc.php", 80);
    $this->xmlrpc->method('metaWeblog.newPost');

    $request = array($blogid, $bloguser, $blogpass, $thePost, $publishImmediately);

    $this->xmlrpc->request($request);
    $result = $this->xmlrpc->send_request();

    if ( !$result )
    {
        echo $this->xmlrpc->display_error();
    }
    else
    {
        echo '<pre>';
        print_r($this->xmlrpc->display_response());
        echo '</pre>';
    }
}
打印($this->xmlrpc->display_response()); 回声';
function doPost(){

    $this->load->library('xmlrpc');

    $bloguser = "theUserID";
    $blogpass = "thePassword";
    $blogid = 1; 
    $publishImmediately = TRUE;

    $thePost = array(array('title'  => array('this is the title','string'),
                            'description'    => array('this is the description','string')
                            ),
                     'struct');               


    $myPost = "my post";
    //$this->xmlrpc->set_debug(TRUE);
    $this->xmlrpc->server("http://url.to/xmlrpc.php", 80);
    $this->xmlrpc->method('metaWeblog.newPost');

    $request = array($blogid, $bloguser, $blogpass, $thePost, $publishImmediately);

    $this->xmlrpc->request($request);
    $result = $this->xmlrpc->send_request();

    if ( !$result )
    {
        echo $this->xmlrpc->display_error();
    }
    else
    {
        echo '<pre>';
        print_r($this->xmlrpc->display_response());
        echo '</pre>';
    }
}
} }

重要的是要注意实际帖子元素的结构。

如果有其他更好的方法,请提供反馈。有什么消息吗?你找到更好的方法了吗?