Eğer birkaç öğe göndermek istiyorsanız, her yazı için değiştirmek sadece bir kaç şey vardır:
- Yazının başlığı.
- Yazının içeriği
- Yazının kategorisi
- Anahtar kelimeler (isteğe bağlı, ama ben bunu kullanırken sanırım).
Ben de size aynı web sitesi üzerine gönderme konum sanırım çünkü RPC URL, kullanıcı adı, şifre ve kodlama standardıdır. Yani biz sadece aracılığıyla çalıştırabilirsiniz bir dizi 4 adlandırılmış öğeleri saklamak zorunda. Ben başka bir dizide öğeleri saklamak, bu yüzden diziler bir dizi var.
Kolayca böyle bir şey yazabilirsiniz:
// We create a post array that contains an array per post.
// I put in the data index based. First item is title, second is content body, third is category, fourth is keywords.
$posts = array(
array('Title','Contents','category','keywords'),
array('Another post','More content','another category ID','etc.'),
// You can add more items if you want.
);
// These are just general settings that are the same for each post.
$rpcurl = 'http://www.yourwordpressblog.com/xmlrpc.php';
$username = 'myusername';
$password = 'mypassword';
$encoding ='UTF-8';
foreach($posts AS $Post)
{
// From the foreach we get an array with post data each cycle.
// To keep things a bit clear, I will extract the data to seperate variables..
$title = $Post[0];
$body = $Post[1];
$category = $Post[2];
$keywords = $Post[3];
wpPostXMLRPC($title,$body,$rpcurl,$username, $password,$category,$keywords,$encoding);
}