gpt4 book ai didi

PHP Curl 为 XML 提要返回不一致的数据

转载 作者:可可西里 更新时间:2023-10-31 23:25:23 25 4
gpt4 key购买 nike

我正在开发 XML 阅读器,但遇到了一些提要的奇怪问题。使用 CURL 或什至 file_get_contents 提要加载为二进制数据比实际数据更频繁。每当我在浏览器中加载提要时,它看起来都很好。

具体提要是http://www.winnipegsun.com/home/rss.xml

我使用的代码是

$string = file_get_contents("http://www.winnipegsun.com/home/rss.xml");
var_dump( $string );

最佳答案

响应是压缩的:

如果您查看 HTTP header :内容编码:gzip

用PHP解压:

gzinflate(substr($string, 10));

http://php.net/manual/en/function.gzinflate.php

希望有所帮助...干杯

关于PHP Curl 为 XML 提要返回不一致的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5749623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com