【问题标题】:Get all posts using xmlrpc in wordpress在 wordpress 中使用 xmlrpc 获取所有帖子
【发布时间】:2012-03-05 11:16:23
【问题描述】:

我是 wordpress 的新手,我如何在 wordpress 中使用 xmlrpc 从数据库中获取博客文章?请也给我一些参考资料..

我的代码:

$o = WordPress:::XMLRPC->new({
username => 'abc',
password => 'abcd',
proxy => 'http://localhost/folder/xmlrpc.php',
   });
$post = $o->getPost(7);
  echo  $post->{title}; 
?>

上面的代码我用过,但不工作..请帮助我..

谢谢

【问题讨论】:

    标签: wordpress xml-rpc


    【解决方案1】:

    我个人使用IXR_Client 类:

    $client = new IXR_Client('http://url/xmlrpc.php');
    

    然后你必须编写你的方法或使用远程服务器(wp-includes/class-wp-xmlrpc-server.php)并按如下方式调用它:

    if ( !$client->query('nameYouWant.methodeName') ){
        echo('Error occured while executing methodeNamemethod : ' 
             . $client->getErrorCode().":".$client->getErrorMessage()
       );
    }
    $results = $client->getResponse();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-10
      相关资源
      最近更新 更多