Güncelleme: solved this problem cevaba bakınız
I want to make new posts on my blog remotely with XMLRPC api and i m trying to use metaWeblog.newPost function, because it provides much features. I successfully added new posts into wordpress but i failed to post it in a defined category(categories)
i tried lots of various things but failed at end now i m using code from this site http://www.samuelfolkes.com/2009/08/posting-to-wordpress-with-php-and-xml-rpc/
benim ihtiyaçları için kodu aşağı sıyırma sonra burada onun çalışma ince i ne var ve
remotepost.class.php
<?php
class remotePost
{
private $client;
private $wpURL = 'http://localhost/wp/xmlrpc.php ';
private $ixrPath = '/wp-includes/class-IXR.php';
private $uname = 'zxc';
private $pass = 'zxc';
public $postID;
function __construct($content)
{
if(!is_array($content)) throw new Exception('Invalid Argument');
include $this->ixrPath;
$this->client = new IXR_Client($this->wpURL);
$this->postID = $this->postContent($content);
}
private function postContent($content)
{
$content['description'] = $content['description'];
if(!$this->client->query('metaWeblog.newPost','',$this->uname,$this->pass,$content,true)) throw new Exception($this->client->getErrorMessage());
return $this->client->getResponse();
}
}
?>
post.php (sen istersen adlandırabilirsiniz)
<?php
if(isset($_POST['submit']))
{
include "remotepost.class.php";
$content['title'] = $_POST['title'];
$content['categories'] = $_POST['category'];
$content['description'] = $_POST['description'];
try
{
$posted = new remotePost($content);
$pid = $posted->postID;
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress Poster</title>
</head>
<body>
<?php
if(isset($_POST['submit'])) echo "Posted! <a href=\"http://localhost/wp/?p=$pid\">View Post</a><br /><br />";
?>
<form enctype="multipart/form-data" method="post" action="#">
Title
<input type="text" name="title" /> <br />
Category
<input type="text" name="category" /> <br />
Description
<input type="text" name="description" /> <br />
<input type="submit" value="Submit" name="submit" />
</form>
</body>
</html>
nedir bu kod yanlış bilmiyorum: (, sağ dizinde sonrası başarısız