# PHP & Javascript

{% 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="/files/ecKlisX8nfJZzVWMc3im" 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="/files/RyRTG6sN7MebkgESBX8t" alt=""><figcaption><p>Result of Panda Authentication ( PHP )</p></figcaption></figure>

<figure><img src="/files/aEQOugn0fWwKETNiZely" alt=""><figcaption><p>Result of Panda Authentication ( PHP ) with Parameter</p></figcaption></figure>
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.pandadevelopment.net/utilizing-panda-auth-on-your-product/php-and-javascript.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
