What is the simplest library for using wordpress xmlrpc API

I want to use the wordpress XMLRPC API for my last experiment. Do you know what the simplest library is for this? PHP4 compatibility is not important as it is deprecated anyway.

+3
source share
2 answers

Apparently, I got the answer: using my own WordPress XMLRPC processor, which is based on the Incutio XMLRPC library . The file is located in / wp-includes / class-IXR.php

+3
source

. Wordpress. , , / .

function wpPostXMLRPC($title, $body, $rpcurl, 
                      $username, $password, $categories=array(1))
{
   $categories = implode(",", $categories);
   $XML = "<title>$title</title>".
          "<category>$categories</category>".
   $body = "Example body text - hallo wordpress";

   $params = array('','',$username,$password,$XML,1);
   $request = xmlrpc_encode_request('blogger.newPost',$params);
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
   curl_setopt($ch, CURLOPT_URL, $rpcurl);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($ch, CURLOPT_TIMEOUT, 1);
   curl_exec($ch);
   curl_close($ch);
}

, , ...

PEAR XML-RPC- .

+2

Source: https://habr.com/ru/post/1716079/


All Articles