[insert_php] $userId = $_GET['userId']; $url = 'https://feather-potato.glitch.me/get-wallet-katasiacoin?userId='.$userId ; $headers = array('Content-Type: application/json'); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $result = curl_exec($ch); curl_close($ch); $wallet = json_decode($result, true); $wallet2 = json_decode($result, true); $sumcom = 0; $sumwithdrawn = 0; foreach( $wallet as $wallet_item ) { if($wallet_item['type'] == 'order') { $sumcom = $sumcom + $wallet_item['commission']; }else if($wallet_item['type'] == 'withdrawn') { $sumwithdrawn = $sumwithdrawn + $wallet_item['withdrawn_amount']; } } $balance = $sumcom - $sumwithdrawn ; echo '

ใช้เหรียญ Katasia Coin

'; echo '

Katasia Coin คงเหลือจำนวน '.$balance.' เหรียญ

'; [/insert_php]
จำนวนเหรียญ: