How to check a large list of Indexed URL in search engine using a Java Program

Discussion in 'Java' started by manojrawat77, Sep 24, 2015.

  1. manojrawat77

    manojrawat77 New Member

    Joined:
    Sep 7, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to check thousands of URLs from search engine index, If they are existing or not. I need a Java program which can trigger these url one at a time to the search engine and record the response If it exists or not. I already ask this question to some Java questions and answers forum. But still I am waiting for complete solution. Someone there who would be willing to spend some time to support me to solve this problem.
     
  2. alia123

    alia123 New Member

    Joined:
    Jan 8, 2016
    Messages:
    65
    Likes Received:
    5
    Trophy Points:
    0
    Hey, try using this code :
    Code:
    import java.io.IOException;
    import java.net.*;
    import java.util.*;
    
    public class URLAccess {
        public List<String> urls;
    
        public static void main(String[] args) {
            URLAccess ua = new URLAccess();
            ua.run();
        }
    
        public URLAccess() {
            this.urls = new ArrayList<String>();
            // Read them from external XML or some other sources instead!
            this.urls.add("http://google.com");
            this.urls.add("http://alksdfjlaksjdflkajsdf.com");
        }
    
        public void run() {
            this.urls.forEach(this::accessUrl);
        }
    
        public void accessUrl(String urlString) {
            try {
                URL url = new URL(urlString);
                URLConnection urlConnection = url.openConnection();
                urlConnection.connect();
                System.out.println("Success");
            }
            catch (IOException ignored) {
                System.out.println("Failed");
            }
        }
    }
    
    Or if you need any help you can check " http://www.keenesystems.com/Services/SoftwareDevelopment.aspx "

    Regards
    Alia
     
    boyiajas@gmail.com likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice