How do I scan (as in scanf (from C) and the Scanner class (from Java)) in a webpage's content (html) and use it as the input for my program?
string[] line = new string[length];
for (int i = 0; i < line.Length; i++) {
line[i] = Console.ReadLine();
//Can I have ReadLine read from a website not the Console?
}
e.g. I want to put a text file containing the schedules for the bus near me on web server, then access this and use it to generate the output for my application. This way I can update it and always have access to these updates.
P.S. I'm a beginning programmer, and particularly a beginning C# programmer, so I'm having trouble finding what I'm looking for as I don't know quite what to search for.
Thanks for the help: I was able to start searching for the right thing and this worked:
class MainClass
{
public static void Main (string[] args)
{
// Create web client.
WebClient client = new WebClient();
// Download string.
string value = client.DownloadString("http://www.example.com");
// Write values.
Console.WriteLine("--- WebClient result ---");
Console.WriteLine(value.Length);
Console.WriteLine(value);
}
}