Home > Article > Backend Development > PHP code for offline posting to WordPress and other websites that support xmlrpc_PHP tutorial
I made a Gintama website last week
http://www.iyinhun.com
Fans of hot-blooded anime who like to complain can check it out.
Because it is quite difficult to do it alone, I want to make an automatic maintenance program (actually it means collector)
Below is the code for PHP to send articles to such websites (the code for PHP to post offline to WordPress, blogbus, cnblogs and other websites that support xmlrpc)
Change the classification attributes (categories, mt_keywords) yourself.
Attached is the class library of wordpress xmlrpc protocol
function send_to_other($web,$title,$con,$USER,$PASS,$count=-1) { $client = new IXR_Client($web); $content['title'] = $title; //$get_post_info->post_category; $content['categories'] = array("同人"); $content['description'] = $con; // $content['custom_fields'] = array( array('key' => 'my_custom_fied','value'=>'yes') ); $content['mt_keywords'] = '同人'; if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, true)) { die( 'Error while creating a new post' . $client->getErrorCode() ." : ". $client->getErrorMessage()); } $ID = $client->getResponse(); if($ID) { // echo 'Post published with ID:#'.$ID; } return $post_ID; }