I'm trying to return results from the chain.so blockchain API. When I make an API call with the URL https://chain.so/api/v2/get_tx_received/BTC/3Mk6mNxzXJQegkc276N2pCMRwWHMpMjgbP
The results show correctly in a web browser.
I get the following error in PHP:
Warning: file_get_contents(https://chain.so/api/v2/get_tx_received/BTC/3Mk6mNxzXJQegkc276N2pCMRwWHMpMjgbP): failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in /Applications/XAMPP/xamppfiles/htdocs/test/chainso-api.php on line 8
Code I'm using:
$url = "https://chain.so/api/v2/get_tx_received/BTC/3Mk6mNxzXJQegkc276N2pCMRwWHMpMjgbP";
$content = file_get_contents($url);
echo $content;
I have also tried using cURL, but can't get results to return using it either. I have noticed cloudflare is used on the API, could that be preventing the results from being returned?