How to get data from url

I have the data presented on the website and they are presented in the following image: enter image description here

this website offers values ​​for some parameters that are updated every time. now I want to get this data according to the column name and row number in android APP, I know how to open an http connection. but, unfortunately, I don’t know where I should start and how to read the data presented in the image.

Your help is greatly appreciated.

+5
source share
3 answers

If you do not have a special data source to work with, you must read the contents of the website and then process it manually. Here is a link from the java tutorials on how to read the URL connection.

import java.net.*;
import java.io.*;

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL oracle = new URL("http://www.oracle.com/");
        URLConnection yc = oracle.openConnection();
        BufferedReader in = new BufferedReader(new InputStreamReader(
                                yc.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null) 
            System.out.println(inputLine);
        in.close();
    }
}

EDIT:

-, ( ):

System.setProperty("http.proxyHost", "3.182.12.1");
System.setProperty("http.proxyPort", "1111");
+11

. - , ?

0

If the data is only clear text and the table format does not change, you can parse the entire table, for example, after reading the line “-------..." you can analyze the values ​​using a scanner

 Scanner s;
 while ((inputLine = in.readLine()) != null)
 {
   s = new Scanner(input).useDelimiter(" ");
   //Then readthe Values like
   value = s.next()); // add all values in a list or array       
 } 
 s.close();
0
source

All Articles