You probably can not because the site blocks some requests and asks you to confirm that it is not a robot.
This protection basically works as follows:
When entering the site, the code checks whether or not the request has the cookie cf_clearance
with a token
valid, if it does not display reCaptcha
Google.
jsonformatter.org probably uses token
to circumvent this protection. In cookies
, it would look something like this:
<?php
/* Inicia a biblioteca cURL com a URL */
$ch = curl_init("https://www.cryptocompare.com/api/data/coinsnapshotfullbyid/?id=1182");
/* Informa que deseja capturar o resultado */
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
/* Desabilita a verificação do certificado SSL */
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
/* Informa o Cookie com o token válido para burlar a proteção */
curl_setopt($ch, CURLOPT_COOKIE, "cf_clearance=3def377bda6f9be22251eff64cb617c157011246-1518023345-604800");
/* Define o User-Agent para burlar a proteção */
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36");
/* Captura a resposta */
$response = curl_exec($ch);
/* Captura os erros, caso haja */
$error = curl_error($ch);
/* Captura as informações da requisição */
$info = curl_getinfo($ch);
/* Fecha a requisição e exibe o resultado */
curl_close($ch);
echo($response);