Home > Backend Development > PHP Tutorial > PHP code for offline posting to WordPress and other websites that support xmlrpc_PHP tutorial

PHP code for offline posting to WordPress and other websites that support xmlrpc_PHP tutorial

WBOY
Release: 2016-07-20 11:12:40
Original
950 people have browsed it

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;  
}  
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444555.htmlTechArticleLast week I made a Gintama website http://www.iyinhun.com Fans of passionate anime who like to complain You can take a look. Because it is difficult to do it alone, I want to make an automatic maintenance program (actually...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template