snoopy 发表blog文章

include_once 'Snoopy.class.php';
$snoopy = new Snoopy;
//登录blogbus,获取cookie
$loginUrl = 'http://passport.blogbus.com/login';
$loginFormData['username'] = 'neverfailor';
$loginFormData['password'] = '66263679';
$snoopy->submit($loginUrl, $loginFormData);
$snoopy->setcookies();
$cookies = $snoopy->cookies;
//表单页面
$blogFormUrl = 'http://blog.home.blogbus.com/5865443/posts/form';
$snoopy->fetch($blogFormUrl);
$snoopy->setcookies();
$cookies = $snoopy->cookies;
//post数据
$blogPostUrl = 'http://blog.home.blogbus.com/5865443/posts/';
$blogPostForm = array(
	'title' => '321333',
	'content' => '132131',
	'post_time' => date('Y-m-d H:i'),
	'sort_id' => '',
	'tags' => 'dsafasf',
	'excerpt' => 'fdsaasfsaf',
	'visibility' => 'public',
	'password' => '',
	'always_top' => '1',
	'allow_comment' => '1',
	'allow_trackback' => '1',
	'allow_auto_link' => '1'
);
$snoopy->referer = $blogFormUrl;
$snoopy->cookies = $cookies;
$snoopy->submit($blogPostUrl, $blogPostForm);

 

FROM:http://blog.csdn.net/neverfailor/article/details/5933753

你可能感兴趣的:(Blog)