I am working on a project. I need to figure out the state and operator of the phone number entered by user. I tried making the url connection using jsoup and tried to retrieve the location and operator. But it is not working.
Code is:
public class WebScraper { public static void main(String args[]) throws IOException { //String url; String mobileNumber = "9566171277"; String url ="http://trace.bharatiyamobile.com/?numb="+mobileNumber; Document doc = Jsoup.connect(url).get(); Elements links = doc.select("span.bluetext"); // Elements media = doc.select("[src]"); // Element imports = doc.select("div.eachStory").first(); //Elements resultLinks = doc.select("table>tbody>tr"); // PrintWriter out = new PrintWriter(new BufferedWriter(new // FileWriter("Data.txt", true))); for (int i = 0; i < links.size(); i++) { System.out.println(links.get(i).text()); // out.println(resultLinks.get(i)); } } } Edit: I changed the title, since the solution of the problem has in fact nothing to do with the specifics of the old tilte. It was
How to get location and operator of mobile number using java program?