lundi 19 novembre 2018

PHP using for inside for

can someone help me to code executing data using random or sequential api list

i have 10 data and 3 api list, and i want the code doing like this :

data 1  executed by api 1
data 2  executed by api 2
data 3  executed by api 3
data 4  executed by api 1
data 5  executed by api 2
data 6  executed by api 3
data 7  executed by api 1
data 8  executed by api 2
data 9  executed by api 3
data 10 executed by api 1

i try to code like this and the result was not as i expected :

if(isset($argv[1])){
$no = 1;
$api = 0;
$total = count(explode("\n",file_get_contents($argv[1])));
$listapi = file_get_contents($argv[2]);
$listml = file_get_contents($argv[1]);
$ex = explode("\n",$listapi);
$exx = explode("\n",$listml);
for ($ee = 0; $ee < count($exx); $ee++) {
    for ($api = -1; $api < count($listapi); $api++) {
    $send = json_decode($curl->get($ex[$api]."?ee=".$exx[$ee]));
    $no++;
    echo "OK\n";
    if ($api % count($ex) == 3) {
        $api = -1;
        echo "Rolling\n";
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire