首页 > 解决方案 > 如何使用 file_get_contents() 获取网站 URL 云耀斑的内容

问题描述

这是我的代码:

$url = 'https://cryptoland.net/api/v1/live-price?q=selected'
$json = file_get_contents($url);
$obj = json_decode($json);
var_dump($obj) ;

当我在浏览器中手动使用 URL 时,它工作正常!

但是这个网站使用云耀斑 ddos​​ 保护 file_get_contents 不工作并显示

failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable

我该如何解决?

请帮我

标签: phpweb-crawlercloudflare

解决方案


推荐阅读