<?php
$conn= mysqli_connect("localhost","tradebot_revotech","revotech@123","tradebot_revotech");


$pairs=mysqli_query($conn,"select * from tradepair_list where status='1'");

$required_pairs=array();
if($pairs)
{
   while($get_pairs=mysqli_fetch_array($pairs))
   {
      $required_pairs[]=$get_pairs['pair_name'];
   }
}

$i=0;
 $data_binance = json_decode(file_get_contents('https://aqua-x.co/trading_pairs.json'), true);
 if($data_binance) 
 {
      foreach($required_pairs as $pair) 
      {
            $symbol_find = $pair . 'USDT';
            foreach($data_binance as $data) 
            {
                 if($data['symbol'] == $symbol_find) 
                 {
                        $output[$i]['symbol'] = $data['symbol'];
                      $output[$i]['price'] = $data['lastPrice'];
                     $output[$i]['change'] = $data['priceChangePercentage'];
                    $i++;        
                 }
                
                
            }
      }
 }
 echo '<pre>';
 print_r($output);
 echo '</pre>';
 
 $k = 0;
 if($output)
 {
   foreach ($output as $key => $value) {
     $output[$k] = $value;
     $k++;
   }
   $output =  array_unique($output,SORT_REGULAR);
 }
 
  if($output)
  {
    foreach ($output as $key => $value) 
    {
        
        echo $value['symbol'].'-'.number_format($value['price'],6);
        echo "<br>";
    }
  }
             
?>