0

I have this JSON url https://api.coinpaprika.com/v1/tickers/eth-ethereum?quotes=INR and I want to display name, symbol and rank as the output. I have used this code in my php file but could not figure out how to display just name, symbol and rank.

<?php

$url = "https://api.coinpaprika.com/v1/tickers/eth-ethereum?quotes=INR";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);

?>

2
  • what you mean with "but could not figure out how to display just name, symbol and rank."? Display how? Commented Jun 26, 2021 at 5:48
  • Thanks. I just need to show name, symbol and rank as output but I do not know how to modify above code so result shows name, symbol and rank. Do I add echo $name in the code to show name? Commented Jun 26, 2021 at 5:51

1 Answer 1

1

With something like this:

echo 'Name: ' . $resp['name'] . '<br>';
echo 'Symbol: ' . $resp['symbol'] . '<br>';
echo 'Rank: ' . $resp['rank'];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.