# Happ Proxy Subscription Converter

# Happ Proxy Subscription Converter

**Author:** bubasik
**Source:** https://gist.github.com/bubasik/af37247b71ca0b253161b48614aba61a
**Title (RU):** Как вытащить vpn список vless серверов из happ подписки для v2raya, v2rayN приложений и подключить устройств выше лимита по подписке
**Title (EN):** How to extract the VLESS server list from a Happ subscription for V2RayA / V2RayN clients and connect more devices than the subscription limit allows

## Files in the gist

### 1. `happ_converter.php`
PHP script that emulates the Happ Android client:
- Spoofs HTTP headers (User-Agent, custom Happ headers) to match a real Happ device
- Implements a 3-hour response cache to minimize upstream requests
- Auto-decodes the base64 subscription response
- Accepts custom HWID and IP parameters via query string, so each consuming device can present a unique fingerprint
- Re-emits the VLESS subscription as a standard base64 list

### 2. `debug_headers.php`
Debug utility — logs all incoming HTTP requests and headers to `requests.log`. Purpose: point a real Happ app at this script once, capture the exact headers the app sends (including the custom HWID and any proprietary auth fields), then copy those headers into `happ_converter.php`.

```php
// Path to store all incoming requests
define('LOG_OUTPUT', __DIR__ . '/requests.log');

$data = sprintf(
    "[%s]\n%s %s %s\n\nHTTP HEADERS:\n",
    date('c'),
    $_SERVER['REQUEST_METHOD'],
    $_SERVER['REQUEST_URI'],
    $_SERVER['SERVER_PROTOCOL']
);

foreach ($_SERVER as $name => $value) {
    if (preg_match('/^HTTP_/', $name)) {
        $name = strtr(substr($name, 5), '_', ' ');
        $name = ucwords(strtolower($name));
        $name = strtr($name, ' ', '-');
        $data .= $name . ': ' . $value . "\n";
    }
}

$data .= "\nREQUEST BODY:\n" . file_get_contents('php://input') . "\n";
file_put_contents(LOG_OUTPUT, $data, FILE_APPEND|LOCK_EX);
echo("OK!\n");
```

### 3. `parser_happ_subscription_to_vless_links.md`
Russian-language documentation covering:
- Installation and setup on a PHP host
- Header interception procedure using `debug_headers.php`
- Integration with V2RayN, V2RayA, Clash, and SingBox (point the client at the PHP URL as a subscription)
- Device limit circumvention via HWID randomization
- `.htaccess` protection for the converter endpoint
- Troubleshooting notes

## Core workflow

1. Deploy both PHP scripts to any PHP-capable host
2. Temporarily point the real Happ mobile app at `debug_headers.php` as its subscription URL
3. Read `requests.log`, extract the headers Happ sent
4. Paste those headers into `happ_converter.php`, set the upstream subscription URL
5. Use `happ_converter.php?hwid=<random>&ip=<something>` as the subscription URL in V2RayN / V2RayA / Clash / SingBox
6. Each client uses a distinct `hwid` parameter so the provider sees them as separate devices
