2016-11-11 29 views
2
$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); 

私はこの問題を解決することができますどのように私はエラー32300 を得たXMLRPC wordpressのAPIからのポストを挿入しようとしますが?XMLRPC要求オブジェクトエラー32300転送エラー

次の結果が得られました。

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 
     ) 

) 
+2

最後に、私は正確な問題を発見しました。実際にはhttps:プロトコルの問題で問題でした。私が使用したコードはhttpsで動作しません。私はhttpsに次のコードを使用しました。 –

答えて

1

ここに私が見つけたワードプレスのサポートチケットがあります。私はメモリ PHPの致命的なエラーの外にあったが、https://mu.wordpress.org/forums/topic/5997

:8388608バイトの許可メモリサイズが10Mを許可する 変更php.iniのを使い果たし、それを修正するようです。 試してみてください。

2

このリンク(https://codex.wordpress.org/XML-RPC_WordPress_API)に従ってください。 ポートを変更すると、すべてのポートがデフォルト値の80になるので便利です。 ポート番号を81またはその他の番号に変更すると役立ちます。

1

実際、問題はhttps protocalです。 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(); 
関連する問題