gelir_ortagim adlı üyeden alıntı: mesajı görüntüle
sadece echo ve print ile ekrana yazdırmak istiyorum

<?php

$url = 'https://www.bitexen.com/api/v1/ticker/';

$options = [
    'http' => [
        'method' => 'GET',
        'header' => 'Content-Type: application/json'
    ]
];

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response === false) {
    die('API\'ye erişilemedi.');
}

$data = json_decode($response, true);

if ($data === null || !isset($data['status']) || $data['status'] !== 'success' || !isset($data['data']['ticker'])) {
    die('API yanıtı geçersiz veya beklenmeyen bir formatta.');
}

$ticker_data = $data['data']['ticker'];

foreach (['ETHTRY', 'BTCTRY','USDTTRY'] as $pair) {
    if (isset($ticker_data[$pair])) {
        $pair_data = $ticker_data[$pair];
        echo "Market: $pair<br>";
        echo "Bid: " . $pair_data['bid'] . "<br>";
        echo "Ask: " . $pair_data['ask'] . "<br>";
        echo "Last Price: " . $pair_data['last_price'] . "<br>";
        echo "Last Size: " . $pair_data['last_size'] . "<br>";
        echo "Volume 24h: " . $pair_data['volume_24h'] . "<br>";
        echo "Change 24h: " . $pair_data['change_24h'] . "<br>";
        echo "Low 24h: " . $pair_data['low_24h'] . "<br>";
        echo "High 24h: " . $pair_data['high_24h'] . "<br>";
        echo "Avg 24h: " . $pair_data['avg_24h'] . "<br>";
        echo "Timestamp: " . date('Y-m-d H:i:s', $pair_data['timestamp']) . "<br>";
        echo "<br>";
    }
}

?>