【问题标题】:Getting different results from wpcom_vip_file_get_contents, file_get_contents, browser, curl从 wpcom_vip_file_get_contents、file_get_contents、浏览器、curl 获得不同的结果
【发布时间】:2013-03-05 23:40:52
【问题描述】:

我正在尝试从这个 URL 的 json 页面加载内容:

http://makeprojects.com/api/1.0/guide/4

当我通过 file_get_contents 加载时,我没有得到零件数量和类型...这里有什么想法吗?

在此 Gist 中提供一些不同响应的示例:

https://gist.github.com/whyisjake/5095391

谢谢!

【问题讨论】:

    标签: php json file-get-contents


    【解决方案1】:

    并非type 的每个实例在您调用的 JSON 文件中都有一个值。不过,Your gist 确实表明您正在获得 typequantity 可用时。

    【讨论】:

    • 是的,奇怪的是它们会如此不同。我不认为这是验证响应的问题,因为 curl 抓取与浏览器相同的东西。
    • 那我一定不明白问题出在哪里。您提供的 API 链接和您在 gist 中显示的结果似乎是相似的结果。除了file_get_contents 的结果之外,要点是什么吗?
    猜你喜欢
    • 2019-09-22
    • 1970-01-01
    • 1970-01-01
    • 2014-06-20
    • 1970-01-01
    • 2011-02-02
    • 2017-09-25
    • 1970-01-01
    相关资源
    最近更新 更多