Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php $bin = $binaa; //=================================================== function g..

Decoded Output download

<?php 
$bin = $binaa; 
 
//=================================================== 
function getFlags($code) { 
    $code = strtoupper($code); 
    if ($code === 'AFGHANISTAN') return ''; 
    if ($code === 'ALBANIA') return ''; 
    if ($code === 'ALGERIA') return ''; 
    if ($code === 'ANDORRA') return ''; 
    if ($code === 'ANGOLA') return ''; 
    if ($code === 'ANTIGUA AND BARBUDA') return ''; 
    if ($code === 'ARGENTINA') return ''; 
    if ($code === 'ARMENIA') return ''; 
    if ($code === 'AUSTRALIA') return ''; 
    if ($code === 'AUSTRIA') return ''; 
    if ($code === 'AZERBAIJAN') return ''; 
    if ($code === 'BAHAMAS') return ''; 
    if ($code === 'BAHRAIN') return ''; 
    if ($code === 'BANGLADESH') return ''; 
    if ($code === 'BARBADOS') return ''; 
    if ($code === 'BELARUS') return ''; 
    if ($code === 'BELGIUM') return ''; 
    if ($code === 'BELIZE') return ''; 
    if ($code === 'BENIN') return ''; 
    if ($code === 'BHUTAN') return ''; 
    if ($code === 'BOLIVIA') return ''; 
    if ($code === 'BOSNIA AND HERZEGOVINA') return ''; 
    if ($code === 'BOTSWANA') return ''; 
    if ($code === 'BRAZIL') return ''; 
    if ($code === 'BRUNEI') return ''; 
    if ($code === 'BULGARIA') return ''; 
    if ($code === 'BURKINA FASO') return ''; 
    if ($code === 'BURUNDI') return ''; 
    if ($code === 'CABO VERDE') return ''; 
    if ($code === 'CAMBODIA') return ''; 
    if ($code === 'CAMEROON') return ''; 
    if ($code === 'CANADA') return ''; 
    if ($code === 'CENTRAL AFRICAN REPUBLIC') return ''; 
    if ($code === 'CHAD') return ''; 
    if ($code === 'CHILE') return ''; 
    if ($code === 'CHINA') return ''; 
    if ($code === 'COLOMBIA') return ''; 
    if ($code === 'COMOROS') return ''; 
    if ($code === 'CONGO') return ''; 
    if ($code === 'CONGO, DEMOCRATIC REPUBLIC OF THE') return ''; 
    if ($code === 'COSTA RICA') return ''; 
    if ($code === 'CROATIA') return ''; 
    if ($code === 'CUBA') return ''; 
    if ($code === 'CYPRUS') return ''; 
    if ($code === 'CZECH REPUBLIC') return ''; 
    if ($code === 'DENMARK') return ''; 
    if ($code === 'DJIBOUTI') return ''; 
    if ($code === 'DOMINICA') return ''; 
    if ($code === 'DOMINICAN REPUBLIC') return ''; 
    if ($code === 'ECUADOR') return ''; 
    if ($code === 'EGYPT') return ''; 
    if ($code === 'EL SALVADOR') return ''; 
    if ($code === 'EQUATORIAL GUINEA') return ''; 
    if ($code === 'ERITREA') return ''; 
    if ($code === 'ESTONIA') return ''; 
    if ($code === 'ESWATINI') return ''; 
    if ($code === 'ETHIOPIA') return ''; 
    if ($code === 'FIJI') return ''; 
    if ($code === 'FINLAND') return ''; 
    if ($code === 'FRANCE') return ''; 
    if ($code === 'GABON') return ''; 
    if ($code === 'GAMBIA') return ''; 
    if ($code === 'GEORGIA') return ''; 
    if ($code === 'GERMANY') return ''; 
    if ($code === 'GHANA') return ''; 
    if ($code === 'GREECE') return ''; 
    if ($code === 'GRENADA') return ''; 
    if ($code === 'GUATEMALA') return ''; 
    if ($code === 'GUINEA') return ''; 
    if ($code === 'GUINEA-BISSAU') return ''; 
    if ($code === 'GUYANA') return ''; 
    if ($code === 'HAITI') return ''; 
    if ($code === 'HONDURAS') return ''; 
    if ($code === 'HUNGARY') return ''; 
    if ($code === 'ICELAND') return ''; 
    if ($code === 'INDIA') return ''; 
    if ($code === 'INDONESIA') return ''; 
    if ($code === 'IRAN') return ''; 
    if ($code === 'IRAQ') return ''; 
    if ($code === 'IRELAND') return ''; 
    if ($code === 'ISRAEL') return ''; 
    if ($code === 'ITALY') return ''; 
    if ($code === 'IVORY COAST') return ''; 
    if ($code === 'JAMAICA') return ''; 
    if ($code === 'JAPAN') return ''; 
    if ($code === 'JORDAN') return ''; 
    if ($code === 'KAZAKHSTAN') return ''; 
    if ($code === 'KENYA') return ''; 
    if ($code === 'KIRIBATI') return ''; 
    if ($code === 'KUWAIT') return ''; 
    if ($code === 'KYRGYZSTAN') return ''; 
    if ($code === 'LAOS') return ''; 
    if ($code === 'LATVIA') return ''; 
    if ($code === 'LEBANON') return ''; 
    if ($code === 'LESOTHO') return ''; 
    if ($code === 'LIBERIA') return ''; 
    if ($code === 'LIBYA') return ''; 
    if ($code === 'LIECHTENSTEIN') return ''; 
    if ($code === 'LITHUANIA') return ''; 
    if ($code === 'LUXEMBOURG') return ''; 
    if ($code === 'MADAGASCAR') return ''; 
    if ($code === 'MALAWI') return ''; 
    if ($code === 'MALAYSIA') return ''; 
    if ($code === 'MALDIVES') return ''; 
    if ($code === 'MALI') return ''; 
    if ($code === 'MALTA') return ''; 
    if ($code === 'MARSHALL ISLANDS') return ''; 
    if ($code === 'MAURITANIA') return ''; 
    if ($code === 'MAURITIUS') return ''; 
    if ($code === 'MEXICO') return ''; 
    if ($code === 'MICRONESIA') return ''; 
    if ($code === 'MOLDOVA') return ''; 
    if ($code === 'MONACO') return ''; 
    if ($code === 'MONGOLIA') return ''; 
    if ($code === 'MONTENEGRO') return ''; 
    if ($code === 'MOROCCO') return ''; 
    if ($code === 'MOZAMBIQUE') return ''; 
    if ($code === 'MYANMAR') return ''; 
    if ($code === 'NAMIBIA') return ''; 
    if ($code === 'NAURU') return ''; 
    if ($code === 'NEPAL') return ''; 
    if ($code === 'NETHERLANDS') return ''; 
    if ($code === 'NEW ZEALAND') return ''; 
    if ($code === 'NICARAGUA') return ''; 
    if ($code === 'NIGER') return ''; 
    if ($code === 'NIGERIA') return ''; 
    if ($code === 'NORTH KOREA') return ''; 
    if ($code === 'NORTH MACEDONIA') return ''; 
    if ($code === 'NORWAY') return ''; 
    if ($code === 'OMAN') return ''; 
    if ($code === 'PAKISTAN') return ''; 
    if ($code === 'PALAU') return ''; 
    if ($code === 'PALESTINE') return ''; 
    if ($code === 'PANAMA') return ''; 
    if ($code === 'PAPUA NEW GUINEA') return ''; 
    if ($code === 'PARAGUAY') return ''; 
    if ($code === 'PERU') return ''; 
    if ($code === 'PHILIPPINES') return ''; 
    if ($code === 'POLAND') return ''; 
    if ($code === 'PORTUGAL') return ''; 
    if ($code === 'QATAR') return ''; 
    if ($code === 'ROMANIA') return ''; 
    if ($code === 'RUSSIA') return ''; 
    if ($code === 'RWANDA') return ''; 
    if ($code === 'SAINT KITTS AND NEVIS') return ''; 
    if ($code === 'SAINT LUCIA') return ''; 
    if ($code === 'SAINT VINCENT AND THE GRENADINES') return ''; 
    if ($code === 'SAMOA') return ''; 
    if ($code === 'SAN MARINO') return ''; 
    if ($code === 'SAO TOME AND PRINCIPE') return ''; 
    if ($code === 'SAUDI ARABIA') return ''; 
    if ($code === 'SENEGAL') return ''; 
    if ($code === 'SERBIA') return ''; 
    if ($code === 'SEYCHELLES') return ''; 
    if ($code === 'SIERRA LEONE') return ''; 
    if ($code === 'SINGAPORE') return ''; 
    if ($code === 'SLOVAKIA') return ''; 
    if ($code === 'SLOVENIA') return ''; 
    if ($code === 'SOLOMON ISLANDS') return ''; 
    if ($code === 'SOMALIA') return ''; 
    if ($code === 'SOUTH AFRICA') return ''; 
    if ($code === 'SOUTH KOREA') return ''; 
    if ($code === 'SOUTH SUDAN') return ''; 
    if ($code === 'SPAIN') return ''; 
    if ($code === 'SRI LANKA') return ''; 
    if ($code === 'SUDAN') return ''; 
    if ($code === 'SURINAME') return ''; 
    if ($code === 'SWEDEN') return ''; 
    if ($code === 'SWITZERLAND') return ''; 
    if ($code === 'SYRIA') return ''; 
    if ($code === 'TAIWAN') return ''; 
    if ($code === 'TAJIKISTAN') return ''; 
    if ($code === 'TANZANIA') return ''; 
    if ($code === 'THAILAND') return ''; 
    if ($code === 'TIMOR-LESTE') return ''; 
    if ($code === 'TOGO') return ''; 
    if ($code === 'TONGA') return ''; 
    if ($code === 'TRINIDAD AND TOBAGO') return ''; 
    if ($code === 'TUNISIA') return ''; 
    if ($code === 'TURKEY') return ''; 
    if ($code === 'TURKMENISTAN') return ''; 
    if ($code === 'TUVALU') return ''; 
    if ($code === 'UGANDA') return ''; 
    if ($code === 'UKRAINE') return ''; 
    if ($code === 'UNITED ARAB EMIRATES') return ''; 
    if ($code === 'UNITED KINGDOM') return ''; 
    if ($code === 'UNITED STATES') return ''; 
    if ($code === 'URUGUAY') return ''; 
    if ($code === 'UZBEKISTAN') return ''; 
    if ($code === 'VANUATU') return ''; 
    if ($code === 'VENEZUELA') return ''; 
    if ($code === 'VIETNAM') return ''; 
    if ($code === 'YEMEN') return ''; 
    if ($code === 'ZAMBIA') return ''; 
    if ($code === 'ZIMBABWE') return ''; 
    return ''; 
} 
 
//=================================================== 
 
// URL cible 
$url = "https://bincc.pro/"; 
 
 
$data = 'action=searchbins&bins=' . $bin . '&bank=&country='; 
 
// Configuration des en-ttes HTTP 
$header = array( 
    'Host: bincc.pro', 
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0', 
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 
    'Accept-Language: en-US,en;q=0.5', 
    'Content-Type: application/x-www-form-urlencoded', 
    'Content-Length: ' . strlen($data), 
    'Origin: https://bincc.pro', 
    'DNT: 1', 
    'Connection: keep-alive', 
    'Referer: https://bincc.pro/', 
    'Upgrade-Insecure-Requests: 1' 
); 
 
// Initialisation de cURL 
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, br'); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
 
// Excution de la requte 
$result = curl_exec($ch); 
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 
 
// Gestion des erreurs cURL 
if (curl_errno($ch)) { 
    echo json_encode(["error" => "Erreur cURL : " . curl_error($ch)]); 
    curl_close($ch); 
    exit; 
} 
 
// Vrification du statut HTTP 
if ($status_code !== 200) { 
    echo json_encode(["error" => "Erreur HTTP : $status_code"]); 
    curl_close($ch); 
    exit; 
} 
 
// Fermeture de la session cURL 
curl_close($ch); 
 
// Dcompression de la rponse si ncessaire 
if (stripos($result, "") === 0) { // Vrifie si la rponse est gzip 
    $result = gzdecode($result); 
} 
 
// Extraction des donnes avec Regex 
preg_match_all('/<td[^>]*style="text-align: left; border-bottom: 1px solid #ddd;"[^>]*>(.*?)<\/td>/', $result, $matches); 
 
// Vrification des rsultats extraits 
if (!isset($matches[1]) || count($matches[1]) < 6) { 
    echo json_encode(["error" => "Impossible d'extraire les donnes."]); 
    exit; 
} 
 
// Mapping des donnes extraites 
$binx = $matches[1][0]; 
$country = $matches[1][1]; 
$type = $matches[1][2]; 
$level = $matches[1][3]; 
$scheme = $matches[1][4]; 
$bank = $matches[1][5]; 
 
// Fonction pour obtenir les drapeaux ( dfinir) 
function getFlags($country) { 
    // Exemple simple : utiliser des emojis comme drapeaux 
    $flags = [ 
        'SWITZERLAND' => '', 
        'USA' => '', 
        // Ajoutez d'autres pays si ncessaire 
    ]; 
    return $flags[strtoupper($country)] ?? ''; 
} 
 
// Construction du rsultat en JSON 
$binresult = json_encode([ 
    "country" => $country, 
    "scheme" => $scheme, 
    "type" => $type, 
    "brand" => $level, 
    "emoji" => getFlags($country), 
    "bank" => [ 
        "name" => $bank 
    ] 
]); 
 
// Affichage du rsultat 
echo $binresult; 
?> 

Did this file decode correctly?

Original Code

<?php
$bin = $binaa;

//===================================================
function getFlags($code) {
    $code = strtoupper($code);
    if ($code === 'AFGHANISTAN') return '';
    if ($code === 'ALBANIA') return '';
    if ($code === 'ALGERIA') return '';
    if ($code === 'ANDORRA') return '';
    if ($code === 'ANGOLA') return '';
    if ($code === 'ANTIGUA AND BARBUDA') return '';
    if ($code === 'ARGENTINA') return '';
    if ($code === 'ARMENIA') return '';
    if ($code === 'AUSTRALIA') return '';
    if ($code === 'AUSTRIA') return '';
    if ($code === 'AZERBAIJAN') return '';
    if ($code === 'BAHAMAS') return '';
    if ($code === 'BAHRAIN') return '';
    if ($code === 'BANGLADESH') return '';
    if ($code === 'BARBADOS') return '';
    if ($code === 'BELARUS') return '';
    if ($code === 'BELGIUM') return '';
    if ($code === 'BELIZE') return '';
    if ($code === 'BENIN') return '';
    if ($code === 'BHUTAN') return '';
    if ($code === 'BOLIVIA') return '';
    if ($code === 'BOSNIA AND HERZEGOVINA') return '';
    if ($code === 'BOTSWANA') return '';
    if ($code === 'BRAZIL') return '';
    if ($code === 'BRUNEI') return '';
    if ($code === 'BULGARIA') return '';
    if ($code === 'BURKINA FASO') return '';
    if ($code === 'BURUNDI') return '';
    if ($code === 'CABO VERDE') return '';
    if ($code === 'CAMBODIA') return '';
    if ($code === 'CAMEROON') return '';
    if ($code === 'CANADA') return '';
    if ($code === 'CENTRAL AFRICAN REPUBLIC') return '';
    if ($code === 'CHAD') return '';
    if ($code === 'CHILE') return '';
    if ($code === 'CHINA') return '';
    if ($code === 'COLOMBIA') return '';
    if ($code === 'COMOROS') return '';
    if ($code === 'CONGO') return '';
    if ($code === 'CONGO, DEMOCRATIC REPUBLIC OF THE') return '';
    if ($code === 'COSTA RICA') return '';
    if ($code === 'CROATIA') return '';
    if ($code === 'CUBA') return '';
    if ($code === 'CYPRUS') return '';
    if ($code === 'CZECH REPUBLIC') return '';
    if ($code === 'DENMARK') return '';
    if ($code === 'DJIBOUTI') return '';
    if ($code === 'DOMINICA') return '';
    if ($code === 'DOMINICAN REPUBLIC') return '';
    if ($code === 'ECUADOR') return '';
    if ($code === 'EGYPT') return '';
    if ($code === 'EL SALVADOR') return '';
    if ($code === 'EQUATORIAL GUINEA') return '';
    if ($code === 'ERITREA') return '';
    if ($code === 'ESTONIA') return '';
    if ($code === 'ESWATINI') return '';
    if ($code === 'ETHIOPIA') return '';
    if ($code === 'FIJI') return '';
    if ($code === 'FINLAND') return '';
    if ($code === 'FRANCE') return '';
    if ($code === 'GABON') return '';
    if ($code === 'GAMBIA') return '';
    if ($code === 'GEORGIA') return '';
    if ($code === 'GERMANY') return '';
    if ($code === 'GHANA') return '';
    if ($code === 'GREECE') return '';
    if ($code === 'GRENADA') return '';
    if ($code === 'GUATEMALA') return '';
    if ($code === 'GUINEA') return '';
    if ($code === 'GUINEA-BISSAU') return '';
    if ($code === 'GUYANA') return '';
    if ($code === 'HAITI') return '';
    if ($code === 'HONDURAS') return '';
    if ($code === 'HUNGARY') return '';
    if ($code === 'ICELAND') return '';
    if ($code === 'INDIA') return '';
    if ($code === 'INDONESIA') return '';
    if ($code === 'IRAN') return '';
    if ($code === 'IRAQ') return '';
    if ($code === 'IRELAND') return '';
    if ($code === 'ISRAEL') return '';
    if ($code === 'ITALY') return '';
    if ($code === 'IVORY COAST') return '';
    if ($code === 'JAMAICA') return '';
    if ($code === 'JAPAN') return '';
    if ($code === 'JORDAN') return '';
    if ($code === 'KAZAKHSTAN') return '';
    if ($code === 'KENYA') return '';
    if ($code === 'KIRIBATI') return '';
    if ($code === 'KUWAIT') return '';
    if ($code === 'KYRGYZSTAN') return '';
    if ($code === 'LAOS') return '';
    if ($code === 'LATVIA') return '';
    if ($code === 'LEBANON') return '';
    if ($code === 'LESOTHO') return '';
    if ($code === 'LIBERIA') return '';
    if ($code === 'LIBYA') return '';
    if ($code === 'LIECHTENSTEIN') return '';
    if ($code === 'LITHUANIA') return '';
    if ($code === 'LUXEMBOURG') return '';
    if ($code === 'MADAGASCAR') return '';
    if ($code === 'MALAWI') return '';
    if ($code === 'MALAYSIA') return '';
    if ($code === 'MALDIVES') return '';
    if ($code === 'MALI') return '';
    if ($code === 'MALTA') return '';
    if ($code === 'MARSHALL ISLANDS') return '';
    if ($code === 'MAURITANIA') return '';
    if ($code === 'MAURITIUS') return '';
    if ($code === 'MEXICO') return '';
    if ($code === 'MICRONESIA') return '';
    if ($code === 'MOLDOVA') return '';
    if ($code === 'MONACO') return '';
    if ($code === 'MONGOLIA') return '';
    if ($code === 'MONTENEGRO') return '';
    if ($code === 'MOROCCO') return '';
    if ($code === 'MOZAMBIQUE') return '';
    if ($code === 'MYANMAR') return '';
    if ($code === 'NAMIBIA') return '';
    if ($code === 'NAURU') return '';
    if ($code === 'NEPAL') return '';
    if ($code === 'NETHERLANDS') return '';
    if ($code === 'NEW ZEALAND') return '';
    if ($code === 'NICARAGUA') return '';
    if ($code === 'NIGER') return '';
    if ($code === 'NIGERIA') return '';
    if ($code === 'NORTH KOREA') return '';
    if ($code === 'NORTH MACEDONIA') return '';
    if ($code === 'NORWAY') return '';
    if ($code === 'OMAN') return '';
    if ($code === 'PAKISTAN') return '';
    if ($code === 'PALAU') return '';
    if ($code === 'PALESTINE') return '';
    if ($code === 'PANAMA') return '';
    if ($code === 'PAPUA NEW GUINEA') return '';
    if ($code === 'PARAGUAY') return '';
    if ($code === 'PERU') return '';
    if ($code === 'PHILIPPINES') return '';
    if ($code === 'POLAND') return '';
    if ($code === 'PORTUGAL') return '';
    if ($code === 'QATAR') return '';
    if ($code === 'ROMANIA') return '';
    if ($code === 'RUSSIA') return '';
    if ($code === 'RWANDA') return '';
    if ($code === 'SAINT KITTS AND NEVIS') return '';
    if ($code === 'SAINT LUCIA') return '';
    if ($code === 'SAINT VINCENT AND THE GRENADINES') return '';
    if ($code === 'SAMOA') return '';
    if ($code === 'SAN MARINO') return '';
    if ($code === 'SAO TOME AND PRINCIPE') return '';
    if ($code === 'SAUDI ARABIA') return '';
    if ($code === 'SENEGAL') return '';
    if ($code === 'SERBIA') return '';
    if ($code === 'SEYCHELLES') return '';
    if ($code === 'SIERRA LEONE') return '';
    if ($code === 'SINGAPORE') return '';
    if ($code === 'SLOVAKIA') return '';
    if ($code === 'SLOVENIA') return '';
    if ($code === 'SOLOMON ISLANDS') return '';
    if ($code === 'SOMALIA') return '';
    if ($code === 'SOUTH AFRICA') return '';
    if ($code === 'SOUTH KOREA') return '';
    if ($code === 'SOUTH SUDAN') return '';
    if ($code === 'SPAIN') return '';
    if ($code === 'SRI LANKA') return '';
    if ($code === 'SUDAN') return '';
    if ($code === 'SURINAME') return '';
    if ($code === 'SWEDEN') return '';
    if ($code === 'SWITZERLAND') return '';
    if ($code === 'SYRIA') return '';
    if ($code === 'TAIWAN') return '';
    if ($code === 'TAJIKISTAN') return '';
    if ($code === 'TANZANIA') return '';
    if ($code === 'THAILAND') return '';
    if ($code === 'TIMOR-LESTE') return '';
    if ($code === 'TOGO') return '';
    if ($code === 'TONGA') return '';
    if ($code === 'TRINIDAD AND TOBAGO') return '';
    if ($code === 'TUNISIA') return '';
    if ($code === 'TURKEY') return '';
    if ($code === 'TURKMENISTAN') return '';
    if ($code === 'TUVALU') return '';
    if ($code === 'UGANDA') return '';
    if ($code === 'UKRAINE') return '';
    if ($code === 'UNITED ARAB EMIRATES') return '';
    if ($code === 'UNITED KINGDOM') return '';
    if ($code === 'UNITED STATES') return '';
    if ($code === 'URUGUAY') return '';
    if ($code === 'UZBEKISTAN') return '';
    if ($code === 'VANUATU') return '';
    if ($code === 'VENEZUELA') return '';
    if ($code === 'VIETNAM') return '';
    if ($code === 'YEMEN') return '';
    if ($code === 'ZAMBIA') return '';
    if ($code === 'ZIMBABWE') return '';
    return '';
}

//===================================================

// URL cible
$url = "https://bincc.pro/";


$data = 'action=searchbins&bins=' . $bin . '&bank=&country=';

// Configuration des en-ttes HTTP
$header = array(
    'Host: bincc.pro',
    'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0',
    'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language: en-US,en;q=0.5',
    'Content-Type: application/x-www-form-urlencoded',
    'Content-Length: ' . strlen($data),
    'Origin: https://bincc.pro',
    'DNT: 1',
    'Connection: keep-alive',
    'Referer: https://bincc.pro/',
    'Upgrade-Insecure-Requests: 1'
);

// Initialisation de cURL
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate, br');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

// Excution de la requte
$result = curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

// Gestion des erreurs cURL
if (curl_errno($ch)) {
    echo json_encode(["error" => "Erreur cURL : " . curl_error($ch)]);
    curl_close($ch);
    exit;
}

// Vrification du statut HTTP
if ($status_code !== 200) {
    echo json_encode(["error" => "Erreur HTTP : $status_code"]);
    curl_close($ch);
    exit;
}

// Fermeture de la session cURL
curl_close($ch);

// Dcompression de la rponse si ncessaire
if (stripos($result, "\x1f\x8b\x08") === 0) { // Vrifie si la rponse est gzip
    $result = gzdecode($result);
}

// Extraction des donnes avec Regex
preg_match_all('/<td[^>]*style="text-align: left; border-bottom: 1px solid #ddd;"[^>]*>(.*?)<\/td>/', $result, $matches);

// Vrification des rsultats extraits
if (!isset($matches[1]) || count($matches[1]) < 6) {
    echo json_encode(["error" => "Impossible d'extraire les donnes."]);
    exit;
}

// Mapping des donnes extraites
$binx = $matches[1][0];
$country = $matches[1][1];
$type = $matches[1][2];
$level = $matches[1][3];
$scheme = $matches[1][4];
$bank = $matches[1][5];

// Fonction pour obtenir les drapeaux ( dfinir)
function getFlags($country) {
    // Exemple simple : utiliser des emojis comme drapeaux
    $flags = [
        'SWITZERLAND' => '',
        'USA' => '',
        // Ajoutez d'autres pays si ncessaire
    ];
    return $flags[strtoupper($country)] ?? '';
}

// Construction du rsultat en JSON
$binresult = json_encode([
    "country" => $country,
    "scheme" => $scheme,
    "type" => $type,
    "brand" => $level,
    "emoji" => getFlags($country),
    "bank" => [
        "name" => $bank
    ]
]);

// Affichage du rsultat
echo $binresult;
?>

Function Calls

None

Variables

None

Stats

MD5 39d020bd12bace7f579f9d1e45c6074d
Eval Count 0
Decode Time 87 ms