Kod
object(stdClass)#1 (2) { ["status"]=> string(7) "success" ["data"]=> object(stdClass)#2 (2) { ["code"]=> string(6) "eurpln" ["rate"]=> float(4.22852) } }
Jedyne, co potrzebuję to
Kod
4.22852
Obecny kod wygląda tak(usunąłem $apiKey bo to niby dla każdego usera osobny ma być):
<html> <head> <title>PHP Test</title> </head> <body> <?php $apiKey = 'xxxxxx5'; $url = 'http://apiwalutowe.pl/api/'; $query['key'] = $apiKey; $query['code'] = 'EURPLN'; // tutaj ewentualnie inne parametry tabeli poniżej $url = $url . '?' . http_build_query($query); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $json = curl_exec($ch); $info = curl_getinfo($ch); if ($info['code'] != 200) { } $data = json_decode($json); ?> </body> </html>