¿Cómo buscar una página web con palabras clave de una lista .txt? [cerrado]

I am trying to find a tutorial or help on how to import a .txt list of keywords to put into a search function:

http://www.website.com/search.php?word=WORDHERE

it would be a url of that sort, but I want it to go through each item in the list and replace wordhere with that word so it searches each word in the list.

If it comes up as "No matches found." it will create a new list with all the non-matches. I don't care if it exports it to a new .txt or if it floods into another text box. either works.

If a search is matched it will simply ignore it and move to the next.

I'm a newb :( send me to some help :P

preguntado el 11 de septiembre de 13 a las 22:09

Welcome to Stack Overflow! You will solve this problem more effectively by taking some time to learn how to use this site. Here's some help: stackoverflow.com/sobre Be sure to review "Get answers to practical, detailed questions" -

1 Respuestas

Assuming that the .txt file contains one word per line, here is a simple solution:

string[] keywords = System.IO.File.ReadAllLines(@"C:\Temp\keywords.txt");

List<string> nomatch = new List<string>();

System.Net.WebClient wc = new System.Net.WebClient();

foreach (string word in keywords)
{
    string response = wc.DownloadString("http://www.website.com/search.php?word=" + word);

    if (response != null && response.Contains("No matches found"))
        nomatch.Add(word);
}

if (nomatch.Count > 0)
    System.IO.File.WriteAllLines(@"C:\Temp\nomatch.txt", nomatch.ToArray());

Respondido el 11 de Septiembre de 13 a las 23:09

Oh goodness this helps me beyond words. Thank you so much! - user2770470

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.