HLR HTTP ile
Java ile bir sabit hat veya cep telefonu numarasının durumunu alın
Java : API BELGELERİ
- Java ile grup oluştur
- Java ile grup alanı listesini al
- Java ile bir gruba alan ekleyin
- Java ile bir gruptan alan silme
- Gruptaki bir kişiyi silme
- Ülkeyi Java ile e grubuna atama
- Java ile grup irtibat listesini al
- Java ile bir gruba kişi ekleyin
- Bir grubun kişisini Java ile değiştirin
- Java ile bir grubun kişisini sil
- {Language} ile aktif sohbet kanallarının bir listesini alın
- {Language} ile sohbet yoluyla mesaj gönderin
- {Language} ile sohbet yoluyla bir dosya gönderin
- {Language} ile bir sohbette konuşmaların listesini alın
- {Language} ile bir sohbetten mesajların listesini alın
- {Language} ile bir sohbetten okunmamış mesajların bir listesini alın
HLR HTTP ile
String afilnet_class="hlr";
String afilnet_method="checkphonenumbers";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_numbers="100000000,100000001,100000002";
// Create an URL request
String sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&numbers="+afilnet_numbers;
URL url = new URL(sUrl);
StringBuilder builder = new StringBuilder();
BufferedReader theJSONline = new BufferedReader(new InputStreamReader(url.openStream()));
builder.append(theJSONline.readLine());
String content = builder.toString();
String afilnet_class="hlr";
String afilnet_method="checkphonenumbers";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_numbers="100000000,100000001,100000002";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&numbers="+afilnet_numbers;
// We generate the URL
URL myurl = new URL("https://www.afilnet.com/api/http/");
// We create the connection
HttpURLConnection con = (HttpURLConnection) myurl.openConnection();
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
con.setRequestProperty("Content-Length", String.valueOf(post.length()));
con.setRequestMethod("POST");
// We build the
OutputStream os = con.getOutputStream();
os.write(post.getBytes());
os.close();
StringBuilder sb = new StringBuilder();
int HttpResult = con.getResponseCode();
if(HttpResult == HttpURLConnection.HTTP_OK)
{
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"utf-8"));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
System.out.println(""+sb.toString());
} else {
System.out.println(con.getResponseCode());
System.out.println(con.getResponseMessage());
}
String afilnet_class="hlr";
String afilnet_method="checkphonenumbers";
String afilnet_user="user";
String afilnet_password="password";
String afilnet_numbers="100000000,100000001,100000002";
// Create the POST request
String post = "class="+afilnet_class+"&method="+afilnet_method+"&numbers="+afilnet_numbers;
// We generate the URL
URL myurl = new URL("https://www.afilnet.com/api/basic/");
// We create the connection
HttpURLConnection con = (HttpURLConnection) myurl.openConnection();
String encoded = Base64.getEncoder().encodeToString((afilnet_user+":"+afilnet_password).getBytes(StandardCharsets.UTF_8));
con.setRequestProperty("Authorization", "Basic "+encoded);
con.setDoOutput(true);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
con.setRequestProperty("Content-Length", String.valueOf(post.length()));
con.setRequestMethod("POST");
// We build the
OutputStream os = con.getOutputStream();
os.write(post.getBytes());
os.close();
StringBuilder sb = new StringBuilder();
int HttpResult = con.getResponseCode();
if(HttpResult == HttpURLConnection.HTTP_OK)
{
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(),"utf-8"));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line + "\n");
}
br.close();
System.out.println(""+sb.toString());
} else {
System.out.println(con.getResponseCode());
System.out.println(con.getResponseMessage());
}
Parametre | Açıklama | Zorunlu / Seçmeli |
---|---|---|
class=hlr | İstenen sınıf: İsteğin yapıldığı sınıf | Zorunlu |
method=checkphonenumbers | İstenen sınıf yöntemi: İsteğin yapıldığı sınıfın yöntemi | Zorunlu |
user | Afilnet hesabınızın kullanıcısı ve e-postası | Zorunlu |
password | Afilnet hesabınızın şifresi | Zorunlu |
numbers | Ayrılan ülke kodunu içeren telefon numaralarının listesi, (virgül) | Zorunlu |
İstek yaptığınızda aşağıdaki alanları alacaksınız:
- status
-
sonuç (eğer durum = başarı ise), aşağıdaki değerleri alacaksınız:
- credits
-
list
- number
- mccmnc
- imsi
- onname
- onprefix
- oncountry
- ported
- portedcountry
- portedname
- portedprefix
- error
- permanent_error
- hata (eğer durum = hata ise), burada hata kodunu alacaksınız
Muhtemel hata kodları aşağıda listelenmiştir.
kod | Açıklama |
---|---|
MISSING_USER | Kullanıcı veya e-posta dahil değil |
MISSING_PASSWORD | Şifre dahil değil |
MISSING_CLASS | Sınıf dahil değil |
MISSING_METHOD | Yöntem dahil değil |
MISSING_COMPULSORY_PARAM | Zorunlu parametre dahil değil |
INCORRECT_USER_PASSWORD | Yanlış kullanıcı veya şifre |
INCORRECT_CLASS | Yanlış sınıf |
INCORRECT_METHOD | Yanlış yöntem |
Parametreler:
- class : hlr
- method : checkphonenumbers
- user : user
- password : password
- numbers : 100000000,100000001,100000002
İstek:
https://www.afilnet.com/api/http/?class=hlr&method=checkphonenumbers&user=user&password=password&numbers=100000000,100000001,100000002