Preventing Repeated Posts in C # in Wordpress?

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 to post already has it and I wanted it to check ... something like : "If when he is posting, he checks if there is a post with the same title, if he has not posted, otherwise he will post ..." I have already looked into everything that is place.

    
asked by anonymous 19.05.2015 / 19:35

0 answers