Read a web page : Http Connection « Network « Android

Read a web page


//package org.snancekivell.one_day_watcher;

import java.util.LinkedList;

public class site_utils {
    public static final String ADDRESS_1_DAY = "";
    public static LinkedList<String> getpage(){
        LinkedList<String> page = new LinkedList<String>();

            URL url = new URL(ADDRESS_1_DAY);

            InputStream is =url.openStream();

            BufferedReader reader = new BufferedReader(new InputStreamReader(is));

            String line;
            while ((line=reader.readLine())!=null){
        catch(Exception e){

        return page;

    public static LinkedList<String> get_products(LinkedList<String> page) {
        LinkedList<String> products= new LinkedList<String>();

        for (int i=0; i< page.size();i++){
            if (page.get(i).contains("<div class=\"productTitle\">"))
                String head1= page.get(i).trim().replace("</h1>", "");
                String head2 = page.get(i).trim().replace("</h2>", "");
                String price = page.get(i).replace("<li class=\"amount\">", "").replace("</li>", "").trim();

                products.add(head1+" : "+head2+" : "+price);


        return products;


Related examples in the same category

1.Http Connection
2.Using HttpGet to get the web response
3.Create Http connection
4.Http connection with
5.HttpGet and DefaultHttpClient
6.Http Post
7.Simple HTTP Request
8.Http Request Class
9.Http Get and Http Post
10.Get Text from HttpResponse
11.Http Request
12.Http Downloader
13.Is Http Url Available
14.Http Retriever
15.Receive Response from HttpURLConnection
16.Print http headers. Useful for debugging.
17.Return the base URL from the given URL. Example: ->
18.Send message with HttpPost
19.Get Http Stream
20.Generic Object Http Loader
21.Http Get and DefaultHttpClient
22.Gets http output from URL
23.Util for Http Get Http Get Request and return the status code
25.Http Get
26.implements HttpClient
27.Get File From HTTP
28.Make all redirects to go to http in stead of https
29.New Http Client Manager
30.Http Client Manager
31.Multipart Post
32.Get Server Data
33.Yahoo News Crawler
34.Send Packet
35.parse Request Header
36.Data Send Utils
37.This class is in charge of synchronizing the events (with due dates) with Google Calendar
38.Update Favicon
39.Converts key-value pair to appropriate signature for Facebook.