> For the complete documentation index, see [llms.txt](https://help.portfaria.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.portfaria.com/hyper/lisans-api-kullanimi.md).

# Lisans API Kullanımı

## API Nedir?

Açılımı Application Programming Interface olan bir terimdir. Internet sayfalarının veya çeşitli uygulamaların birbirlerine istek göndererek veri toplayabilmesini sağlar.

### Örnek API İsteği Kodları

#### PHP

<pre class="language-php"><code class="lang-php"><strong>// Ürün ID'si - Örnek 1 verelim.
</strong>$productID = 1;
// Çalıştırılan sunucunun domain (alan adı)'nı alacaktır.
$domain = $_SERVER['SERVER_NAME'];
// URL
$url = "https://siteniz.com/API/domainCheck?productID=".$productID."&#x26;domain=".$domain;
<strong>$request = json_decode(file_get_contents($url), true);
</strong><strong>
</strong><strong>// Lisans Kontrolü
</strong><strong>if($request['status'] == false &#x26;&#x26; $request['code'] == 'expired') {
</strong><strong>    // Lisansın süresi bitmiş
</strong><strong>    // Burada die("Lisansınızın süresi bitmiş");
</strong>    // yazdırabilirsiniz.
}elseif($request['status'] == false &#x26;&#x26; $request['code'] == 'no') {
    // Lisans bulunamadı
    // Burada die("Lisans yok");
    // yazdırabilirsiniz.
}    

// Eğer üstteki iki koşuldanda geçerse lisans var demektir.
// Eğer lisansı varsa diye bir kontrol yapmanıza gerek yok.
// Zaten lisansı yoksa yapacağınız işlem sitenin çalışmasını durdurmaktır.
</code></pre>

#### JavaScript

<pre class="language-javascript"><code class="lang-javascript"><strong>// Axios kütüphanesini kullanacağız.
</strong><strong>import axios from 'axios'
</strong>
let ip = "127.0.0.1";
// Ürüne 1 diyelim.
let productID = 1;
let url = "https://hyper.portfaria.com/API/ipCheck?productID="+productID+"&#x26;ip="+ip;

axios.get(url)
    .then((res) => {
        if(res.data.code === "expired") {
            // Lisansın süresi bitmiş
        }else if(res.data.code === "no") {
            // Lisans bulunamadı
        }
    })
</code></pre>

## Nereye istek atmalıyız?

#### Alan Adı (Domain) Kontrol APIsi

<mark style="color:blue;">`GET`</mark> `https://alanadınız.com/API/domainCheck?productID=:id:&domain=:domain:`

:id: = Ürün IDsi\
:domain: = Alan Adı

#### Query Parameters

| Name                                     | Type    | Description |
| ---------------------------------------- | ------- | ----------- |
| id<mark style="color:red;">\*</mark>     | Integer |             |
| domain<mark style="color:red;">\*</mark> | String  |             |

{% tabs %}
{% tab title="200: OK Lisans bulundu!" %}

```json
{
  "status": true,
  "message": "Lisans bulundu!"
}
```

{% endtab %}

{% tab title="200: OK Lisans bulunamadı!" %}

```javascript
{
  "status": false,
  "code": "no",
  "message": "Lisans bulunamadı!"
}
```

{% endtab %}

{% tab title="200: OK Lisansın süresi bitmiş!" %}

```javascript
{
  "status": false,
  "code": "expired",
  "message": "Lisansın süresi bitmiş!"
}
```

{% endtab %}
{% endtabs %}

#### IP Adresi (IPv4) Kontrol APIsi

<mark style="color:blue;">`GET`</mark> `https://alanadınız.com/API/ipCheck?productID=:id:&ip=:ip:`

:id: = Ürün IDsi\
:ip: = IP Adresi (IPv4)

#### Query Parameters

| Name                                 | Type    | Description |
| ------------------------------------ | ------- | ----------- |
| id<mark style="color:red;">\*</mark> | Integer |             |
| ip<mark style="color:red;">\*</mark> | String  |             |

{% tabs %}
{% tab title="200: OK Lisans bulundu!" %}

```json
{
  "status": true,
  "message": "Lisans bulundu!"
}
```

{% endtab %}

{% tab title="200: OK Lisans bulunamadı!" %}

```javascript
{
  "status": false,
  "code": "no",
  "message": "Lisans bulunamadı!"
}
```

{% endtab %}

{% tab title="200: OK Lisansın süresi bitmiş!" %}

```javascript
{
  "status": false,
  "code": "expired",
  "message": "Lisansın süresi bitmiş!"
}
```

{% endtab %}
{% endtabs %}
