我正在尝试通过此链接https://www.usnews.com/rss/the-report在我的wp网站中加载RSS feed 并且它不起作用,但是当我使用来自其他站点的RSS链接时,它们运行良好。
我尝试过PHP和JS方法,但是都一样。
PHP:
as
控制台错误:
$url = 'https://www.usnews.com/rss/the-report';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xmlresponse = curl_exec($ch);
$xml=simplexml_load_string($xmlresponse);
?>
<script>
console.log(<?php echo json_encode($xmlresponse); ?>);
</script>
JS:
<H1>Access Denied</H1>
You don't have permission to access "http://www.usnews.com/rss/the-report" on this server.<P>
Reference #18.5dc90845.1573379102.102cdef0
控制台错误:
$.ajax({
type: "GET",
url: "https://www.usnews.com/rss/the-report",
dataType : 'xml',
crossDomain:true,
success: function(data, status, xhr) {
console.log(data);
}
});
有人可以在上面帮我吗?
谢谢!