Untitled

 avatar
unknown
php
5 months ago
4.3 kB
3
Indexable
<?php 

# DEFINE api settings
#
#

define('API_LNK', '[your link]');
define('API_KEY', '[your api-key]');


# PREPARING cards
# fields separator - \t
# lines separator - \n

$cards  = "6556122431353419\t12\t25\t123\tZIP\tADDRESS\n"; # ccnum month year cvv zip address
$cards .= "6556124431353419\t12\t25\t\t54563\tADSD12\n"; # ccnum month year {no cvv} zip address
$cards .= "5200450587711668\t12\t25\n"; # just ccnum month year
$cards .= "5200450587711661\t12\t25\n"; # just ccnum month year, card number invalid, will be cancelled
$cards .= "3565430001717081\t09\t25\t\t\t\tMARKER_ID\n"; # just ccnum month year AND some marker, like card id inside your system


# CHECKER selection
#
#
$checker = "simple";
#$checker = "authorize";
                     

# Check result arrays
#
#
$checked_list = array(); # checked successfull
$cancelled_list = array(); # cancelled due data error, like card number invalid
$deleted_list = array(); # deleted by your self

# ADD cards to check queue
#
#

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, API_LNK . '?module=api&sub=cardsadd');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, array('api_key' => API_KEY, 'checker' => $checker, 'format' => 'json', 'data' => base64_encode($cards)));
$data = json_decode(curl_exec($ch), true);
curl_close ($ch);

# Parsing request json
#
#
$waiting_list = array();
foreach ($data as $element) {

    if ($element['status'] === 'cancelled') {
        $cancelled_list[] = $element;
    }
    elseif ($element['status'] === 'check_wait' || $element['status'] === 'checking') {
        $waiting_list[$element['api_card_id']] = $element;
        $api_group_id = $element['api_group_id']; # always identical
    }
    elseif ($element['status'] === 'checked') {
        $checked_list[$element['api_card_id']] = $element;
        $api_group_id = $element['api_group_id']; # always identical
    }
    elseif ($element['status'] === 'deleted') {
        $deleted_list[$element['api_card_id']] = $element;
        $api_group_id = $element['api_group_id']; # always identical
    }
}


# Getting results
#
#
while (count($waiting_list) > 0) {

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, API_LNK . '?module=api&sub=cardsresult');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, array('api_key' => API_KEY, 'format' => 'json', 'api_group_id' => $api_group_id));
    $data = json_decode(curl_exec($ch), true);
    curl_close ($ch);

    $waiting_list_new = array();

    foreach ($data as $element) {

        if ($element['status'] === 'check_wait' || $element['status'] === 'checking') {
            $waiting_list_new[$element['api_card_id']] = $element;
        }
        elseif ($element['status'] == 'checked') {
            $checked_list[$element['api_card_id']] = $element;
        }
        elseif ($element['status'] == 'deleted') {
            $deleted_list[$element['api_card_id']] = $element;
        }

    }

    $waiting_list = $waiting_list_new;
}

print "Cancelled:\n";
foreach ($cancelled_list as $element) {
    print $element['card_number'] . "\t" . $element['status_description'] . "\n";
}
print "\n";

print "Deleted:\n";
foreach ($deleted_list as $element) {
    print $element['card_number'] . "\n";
}
print "\n";

print "Checked:\n";
foreach ($checked_list as $element) {
    print $element['card_number'] . "\t" . $element['response_code'] . "\t" . $element['is_valid'] . "\n";
}
print "\n";

function 4check_api_curl($method, $params) {
   
    $default = array(
        'api_key' => API_KEY, 
        'format' => 'json', 
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, API_LNK . '?module=api&sub=' . $method);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $merged);
    $data = json_decode(curl_exec($ch), true);
    curl_close ($ch);

    return $data;
}

?>
Editor is loading...
Leave a Comment