Skip to content

Instantly share code, notes, and snippets.

@fetus-hina
Created September 7, 2011 05:54
Show Gist options
  • Save fetus-hina/1199879 to your computer and use it in GitHub Desktop.
Save fetus-hina/1199879 to your computer and use it in GitHub Desktop.
FC2 他 metaWeblog API 対応ブログ用 API 投稿サンプル
<?php
date_default_timezone_set('Asia/Tokyo');
require_once('Zend/XmlRpc/Client.php');
require_once('Zend/Date.php');
define('BLOG_ID', '0'); // 何でもOK?
define('USERNAME', '********');
define('PASSWORD', '********');
$client = new Zend_XmlRpc_Client('http://blog.fc2.com/xmlrpc.php');
$result =
$client->call(
'metaWeblog.newPost',
array(
BLOG_ID,
USERNAME,
PASSWORD,
array(
'title' => 'タイトル',
'description' => '本文<br>本文',
'mt_text_more' => '続き',
'dateCreated' => Zend_Date::now()),
true)); // publish:boolean
var_dump($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment