Skip to content

Instantly share code, notes, and snippets.

@kerie
Created November 15, 2010 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerie/700232 to your computer and use it in GitHub Desktop.
Save kerie/700232 to your computer and use it in GitHub Desktop.
<?php
$xmlrpcurl='http://luoying.tk/xmlrpc.php';
$blogid='1';
$username='admin';
$password='pass';
$postTitle='标题';
$postContent='正文内容';
require('class-IXR.php'); //这里要引用/wordpress/wp-includes/class-IXR.php
$client = new IXR_Client($xmlrpcurl);
$params=array(
'',
'blog_ID'=>$blogid,
'user_login'=>$username,
'user_pass'=>$password,
'post_content'=>$postContent,
'publish'=>true
);
$params=array_values($params);
$client->query("blogger.newPost",$params);
$response=$client->getResponse();
if ($response['faultCode']==0){
print 'Success';
} else {
print 'Fail:' . $response['faultString'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment