Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $ID = "teleegram"; // API URL $url = "https://toncenter.com/api/v2/getTransactions?address=UQBvSIGZCjFOBBdKS0RD6-S75Af_pnFYzC-3aZAp7jCiDGLm&limit=100&archival=true"; // Initialize cURL $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'accept: application/json' ]); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if ($data && isset($data['ok']) && $data['ok'] === true && isset($data['result'])) { $found = false; foreach ($data['result'] as $tx) { if (isset($tx['in_msg']['message'])) { $message = trim($tx['in_msg']['message']); if ($message === $ID) { $value = $tx['in_msg']['value'] ?? '0'; echo "Transaction found!\n"; echo "Value: $value\n"; $found = true; break; } } } if (!$found) { echo "No transaction with in_msg.message matching the given ID was found.\n"; } } else { echo "Failed to fetch or decode API response.\n"; } ?>
Copy Clear