> For the complete documentation index, see [llms.txt](https://doc.pandadevelopment.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.pandadevelopment.net/utilizing-panda-auth-on-your-product/php-and-javascript.md).

# PHP & Javascript

Best Application for making a Web Project that utilize Key System or Discord Bot such as Key Bypass. Please follow the guidelines of Panda-Auth Terms of Service when making these.

{% tabs %}
{% tab title="NodeJS" %}
You might need to install the  (node-fetch) before you can utilize this client

* npm install node-fetch

```javascript
async function Validate_Panda(hwid, service, key) {
    try {
      const fetch = await import('node-fetch');
      const url = `https://pandadevelopment.net/v2_validation?service=${service}&hwid=${hwid}&key=${key}`;
      const response = await fetch.default(url);
      const data = await response.json();
  
      const v2Authentication = data.V2_Authentication;
      const premiumMode = data.Key_Information.Premium_Mode;
      const noKeyRequirement = data.Key_Information.NoKey_Requirement;


      return { v2Authentication, premiumMode, noKeyRequirement};
    } catch (error) {
      throw new Error('Error fetching data:', error);
    }
  }
  
  // Usage example:

  //hwid could be ( Discord Username / IP / Hardware ID / Fingerprint & etc, Depends how do u use it)
  const hwid = 'YEAA';

  //service is your identifier that registered on your Panda-Auth Account
  const service = 'pandadevkit';

  //Key (If you want ur user to put key) or you can type their keyless, and let the key system authenticate via hwid only
  const key = 'pandadev_d74e6e30c60dc9c5d0db7bbcf2ff115650d73649ebc928a026a61f99d3c63e86';
  
  Validate_Panda(hwid, service, key)
    .then(({ v2Authentication, premiumMode, noKeyRequirement }) => {
      console.log('--------------------------------------');
      console.log('V2 Authentication:', v2Authentication);
      console.log('Premium Mode:', premiumMode);
      console.log('Keyless / Authenticate only HWID:', noKeyRequirement);
      console.log('--------------------------------------');
    })
    .catch(error => console.error(error));
  
```

<figure><img src="https://81876322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcJ8boGj54SwtVeSh3w7A%2Fuploads%2FcNCGfBds2MPXHLAg7j1z%2Fimage.png?alt=media&amp;token=d636e2d5-cab8-4a83-b2fb-e1f8a35fc250" alt=""><figcaption><p>NodeJS Version of ( Panda-Pelican Client Authentication )</p></figcaption></figure>
{% endtab %}

{% tab title="Javascript" %}
No idea why i wrote this tab, soo definitely it's same as NodeJS, but i made it simplify here caz idk.

```javascript
async function fetchData(hwid, service, key) {
  try {
    const url = `https://pandadevelopment.net/v2_validation?service=${service}&hwid=${hwid}&key=${key}`;
    const response = await fetch(url);
    const data = await response.json();

    const v2Authentication = data.V2_Authentication;
    const premiumMode = data.Key_Information.Premium_Mode;
    const noKeyRequirement = data.Key_Information.NoKey_Requirement;

    return { v2Authentication, premiumMode, noKeyRequirement };
  } catch (error) {
    throw new Error('Error fetching data:', error);
  }
}

// Usage example:
const hwid = 'ass';
const service = 'pandadevkit';
const key = 'pandadev_d74e6e30c60dc9c5d0db7bbcf2ff115650d73649ebc928a026a61f99d3c63e86';

fetchData(hwid, service, key)
  .then(({ v2Authentication, premiumMode, noKeyRequirement }) => {
    console.log('V2 Authentication:', v2Authentication);
    console.log('Premium Mode:', premiumMode);
    console.log('No Key Requirement:', noKeyRequirement);
  })
  .catch(error => console.error(error));

```

{% endtab %}

{% tab title="PHP " %}

```php
<?php
function fetchData($hwid, $service, $key) {
    try {
        // Construct the URL
        $url = "https://pandadevelopment.net/v2_validation?service=$service&hwid=$hwid&key=$key";

        // Fetch data from the URL
        $response = file_get_contents($url);

        // Parse JSON response
        $data = json_decode($response, true);

        // Extract required values
        $v2Authentication = $data['V2_Authentication'];
        $premiumMode = $data['Key_Information']['Premium_Mode'];
        $noKeyRequirement = $data['Key_Information']['NoKey_Requirement'];

        return array(
            'V2_Authentication' => $v2Authentication,
            'Premium_Mode' => $premiumMode,
            'NoKey_Requirement' => $noKeyRequirement
        );
    } catch (Exception $e) {
        throw new Exception('Error fetching data: ' . $e->getMessage());
    }
}

// Set content type header to plain text
header('Content-Type: text/plain');

// Usage example:
$hwid = 'test_only'; //You can use a parameter on your PHP to send the HWID to this part or use IP Address or etc.
$service = 'pandadevkit'; //Your Panda-Auth Identifier
$key = 'pandadev_d74e6e30c60dc9c5d0db7bbcf2ff115650d73649ebc928a026a61f99d3c63e86'; //Key

// -------------- Get parameters from the URL --------------
// $hwid = isset($_GET['hwid']) ? $_GET['hwid'] : '';
// $service = isset($_GET['service']) ? $_GET['service'] : '';
// $key = isset($_GET['key']) ? $_GET['key'] : '';
// -------------- Get parameters from the URL --------------

try {
    $result = fetchData($hwid, $service, $key);

    $IsAuthenticated = $result['V2_Authentication'];
    $IsPremiumKey = ($result['Premium_Mode'] ? 'true' : 'false');
    $IsKeyless_Authentication = ($result['NoKey_Requirement'] ? 'true' : 'false');


    echo 'V2 Authentication: ' . $IsAuthenticated . "\n";
    echo 'Premium Mode: ' . $IsPremiumKey. "\n";
    echo 'No Key Requirement: ' . $IsKeyless_Authentication . "\n";
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage() . "\n";
}
?>
```

<figure><img src="https://81876322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcJ8boGj54SwtVeSh3w7A%2Fuploads%2FlmMKjvigCrNDSI5P6QoR%2FScreenshot%202024-05-09%20230658.png?alt=media&amp;token=1e08aebe-00d6-49ca-b3b0-d7d4221c568a" alt=""><figcaption><p>Result of Panda Authentication ( PHP )</p></figcaption></figure>

<figure><img src="https://81876322-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcJ8boGj54SwtVeSh3w7A%2Fuploads%2FmMCyiPRRdPSt4Il6BHnV%2FScreenshot%202024-05-09%20231240.png?alt=media&amp;token=119b2342-d85e-4596-b82e-e1f6dfc34230" alt=""><figcaption><p>Result of Panda Authentication ( PHP ) with Parameter</p></figcaption></figure>
{% endtab %}
{% endtabs %}
