1
I have the following code, using the Joeblogs Wrapper
private static void Postagem(string website)
{
try
{
string link = "http://MEU.SITE";
string username = "user_wp";
string password = "senha_wp";
HtmlWeb web = new HtmlWeb();
HtmlDocument resultat = web.Load(website);
string titulopost = resultat.DocumentNode.SelectNodes("//*[contains(@class,'entry-title')]")[0].InnerHtml;
string conteudo = resultat.DocumentNode.SelectNodes("//*[contains(@class,'entry-content')]")[0].InnerHtml;
var wp = new WordPressWrapper(link + "/xmlrpc.php", username, password);
var post = new Post();
Console.WriteLine("Adicionando post: {0}", titulopost);
post.DateCreated = DateTime.Today.AddHours(0);
post.Title = titulopost;
post.Body = conteudo;
wp.NewPost(post, true);
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
}
}
Only sometimes the post I send him to post already has and I wanted him to check ... something like : "If when he is posting, he checks if there is any post with the same title, if he has not posted, otherwise he posts..." I’ve searched everywhere.