wordpress - Comment not being posted with xml-rpc wp.newComment php -
i have code this.
<?php include('ixr_library.php'); $client = new ixr_client('http://127.0.0.1/wordpress/xmlrpc.php'); $data = array( 'comment_post_id' => 1, 'comment_author' => 'test_author', 'comment_author_email' => 'test@gmail.com', 'comment_author_url' => 'http://test.limewebs.com', 'comment_content' => 'test content', 'comment_type' => '', 'comment_parent' => 0, 'user_id' => 1, 'comment_author_ip' => '127.0.0.1', 'comment_agent' => 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.9.0.10) gecko/2009042316 firefox/3.0.10 (.net clr 3.5.30729)', 'comment_date' => $time, 'comment_approved' => 1, ); if (!$client->query('wp.newcomment','', 'username','password','12',$data)) { die('an error occurred - '.$client->geterrorcode().":".$client->geterrormessage()); } $result = $client->wp_insert_comment($data); print_r($result); ?>
in above code, comment posted wordpress site, content(comment_content) not getting posted.
dude, remove 'comment_' prefix array properties. writing the wpapi class dug deep in heart of wp's xmlrpc. parameters never in order normal person put them. names used not consistent either. it's not guessing game. @ wp core code when not sure... [or use class ;)]
Comments
Post a Comment