Java tutorial
/** * Whois for android, to get the registration information of a domain name. * * Copyright (C) 2016 Old Geek * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package org.oucho.whois; import java.io.IOException; import java.net.SocketException; import org.apache.commons.net.whois.WhoisClient; public class LookupWhoisTask extends LookupTask { protected String doInBackground(String... urls) { String url = urls[0]; String[] parts = url.split("\\:"); String adresse = parts[0]; String host = parts[1]; if ("whois.internic.net".equals(host)) adresse = "=" + adresse; StringBuilder result = new StringBuilder(""); WhoisClient whois = new WhoisClient(); try { whois.connect(host); String whoisData1 = whois.query(adresse); result.append(whoisData1); whois.disconnect(); } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return result.toString(); } protected void onPostExecute(String str) { // This constructor is intentionally empty, pourquoi ? parce que ! } }