3
    $postcontent = array(
        'post_type' => 'post',
        'post_status' => $post_status, 
        'post_title' => $post_title,
        'post_name' => $post_title,
        'post_content' => $post_content,

        'post_thumbnail' => $image_returnInfo['id']
    //  'terms_names'=> array( 'category' => $category_battery),

    );

$res = $client -> query('wp.newPost',1, $usr, $pwd, $postcontent);
$postID =  $client->getResponse();

print_r($client); 

While i tried to insert the post from xmlrpc wordpress api i got error 32300. How can i solve this?

i got following result.

IXR_Client Object
(
    [server] => battery.kis-com.ch
    [port] => 80
    [path] => /battery-station/xmlrpc.php
    [useragent] => The Incutio XML-RPC PHP Library
    [response] => 
    [message] => 
    [debug] => 
    [timeout] => 15
    [headers] => Array
        (
            [Host] => battery.kis-com.ch
            [Content-Type] => text/xml
            [User-Agent] => The Incutio XML-RPC PHP Library
            [Content-Length] => 781
        )

    [error] => IXR_Error Object
        (
            [code] => -32300
            [message] => transport error - HTTP status code was not 200
        )

)
Bharat
  • 2,441
  • 3
  • 24
  • 36
Rocky Prajapati
  • 187
  • 1
  • 15
  • 2
    oh finally i found the exact problem. actually it was problem with the https: protocol issue. the code i have used not work with https. i used following code for https. – Rocky Prajapati Nov 14 '16 at 07:57

3 Answers3

2

Please follow this link (https://codex.wordpress.org/XML-RPC_WordPress_API). Changing the port might help because all the ports take default value 80. Changing it into port number into 81 or other numbers might help.

Dipesh Thapa
  • 84
  • 1
  • 4
1

Here is support ticket on wordpress i have found. https://mu.wordpress.org/forums/topic/5997

Turned out I was out of memory PHP Fatal error: Allowed memory size of 8388608 bytes exhausted Changing php.ini to allow 10M seems to fix it. Please try it.

karman
  • 346
  • 3
  • 20
1

Actually the problem is with https protocal. I used following code for https.

include_once( ABSPATH . WPINC . '/class-IXR.php' );
include_once( ABSPATH . WPINC . '/class-wp-http-ixr-client.php' );


$usr = '****';
$pwd = '*****';
$xmlrpc = 'https://test.ch/xmlrpc.php';
//echo $xmlrpc; 
//echo ABSPATH . WPINC . '/class-IXR.php' ;

// $client = new IXR_Client($xmlrpc);
$client = new WP_HTTP_IXR_CLIENT($xmlrpc);

    $postcontent = array(
        'post_type' => 'post',
        // 'post_status' => 'test', 
        'post_title' => 'test',
        'post_content' => 'test'


    );

$res = $client -> query('wp.newPost',1, $usr, $pwd, $postcontent);
$postID =  $client->getResponse();
Rocky Prajapati
  • 187
  • 1
  • 15