Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9201765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:05:52+00:00 2026-06-17T23:05:52+00:00

How do I scan (as in scanf (from C) and the Scanner class (from

  • 0

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);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:05:53+00:00Added an answer on June 17, 2026 at 11:05 pm
    private void Test()
    {
        string pageData = DownloadWebPage(new Uri("http://www.yourftp.com"));
        //parse data
    }
    
    private string DownloadWebPage(Uri path)
    {
        string webPageData = null;
    
        using (WebClient client = new WebClient())
        {
            client.DownloadStringAsync(path);
            client.DownloadStringCompleted += (sender, args) => webPageData = args.Result;
        }
    
        return webPageData;
    }
    

    You can use the method above to download the text file from your web server once it has uploaded. Just pass the URI to the DownloadWebPage method and it will return the text page. If you want help parsing the text document to provide meaningful C# representations you will need to give an example of the text file and describe how you want to parse it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Java and looking for some help with Java's Scanner class.
I'm looking to use exiftool to scan the EXIF tags from my photos and
Getting an else without if statement: import java.util.Scanner; public class LazyDaysCamp { public static
I'm trying to use a scanner input to calculate a GPA with an array.
I'm writing a program for class which counts words in a string and, if
Need to write a java program from pseudo code, I've got a bit of
My problem lies with trying to access Scanner scan created in one method from
import java.util.*; public class Guess { public static void main (String[] args) { final
import java.util.Scanner; /** *@author Andy *@verison 21.11.2012 */ public class NimGame { public static
I am using Scanner and BufferedReader objects to read text input from a url,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.