【发布时间】:2017-08-20 15:01:47
【问题描述】:
我有一个测试URL,它返回如下的 Json 结果
{"result":[{"Users":{"id":"1","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"2","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"3","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"4","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"5","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"6","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"7","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"8","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"9","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"10","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"11","user_name":"raj","user_password":"rajesh123"}},{"Users":{"id":"12","user_name":"raj","user_password":"rajesh123"}}],"error_code":1}
我的问题是当我在 Chrome 浏览器 上运行此 URL 时,它会返回如上所述的正确响应。但如果是 Postman,它会返回错误并显示以下消息
本站需要 Javascript 才能运行,请在您的浏览器中启用 Javascript 或使用支持 Javascript 的浏览器
PS:在 localhost 中,它 [http://localhost/test/get_user.php] 在 Browser 和 PostMan 中都能正常工作。
【问题讨论】:
-
表示你要命中的url明确禁止抓取。
-
@dimi 我应该如何避免这种情况..??
-
首先,这意味着你不应该那样做。但是,如果您完全确定抓取该网站不会违反使用政策,那么您可以使用解析 javascript 的无头浏览器(例如 phantomjs.org)
-
@Dimi 感谢您的回答。服务器响应问题
标签: php json server localhost postman