使用PHP加载RSS feed导致仅加载部分Feed

时间:2016-03-29 15:01:00

标签: php curl rss

我尝试使用PHP加载和解析feed。但是,当我从PHP加载它时,它只包含40个[item]条目。我尝试用cURL或file_get_contents()加载它。如果我在brouser中打开feed,然后将其保存在本地,然后解析它 - 我有完整数量的[item] s。 问题的原因是什么?

示例代码:

$ch = curl_init();

$xml_url = 'http://tokyotosho.info/rss.php?filter=1&entries=300&cat=1';    

curl_setopt($ch, CURLOPT_URL, $xml_url);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7");

$result = curl_exec($ch);

curl_close($ch);

$xml_data = simplexml_load_string($result);

0 个答案:

没有答案
相关问题