浏览器获取的内容和curl获取的不一致
Jun 06, 2016 pm 08:50 PM
返回是一个JSON字符串 但是我用curl -l http://.... 却无法获取
返回
<code> <title>404 Not Found</title> <h1 id="Not-Found">404 Not Found</h1> The requested URL /mauth/usr/exists was not found on this server. </code>
回复内容:
返回是一个JSON字符串 但是我用curl -l http://.... 却无法获取
返回
<code> <title>404 Not Found</title> <h1 id="Not-Found">404 Not Found</h1> The requested URL /mauth/usr/exists was not found on this server. </code>
问题后来发现是网络链路的问题的,执行curl那台主机与目标服务器是隔绝的,无法互相访问的,蛋疼!
User-Agent, Cookies, Accept, Referer等各种参数都会影响请求结果。
我一般先用Fiddler找出最少需要的参数与Cookie,然后弄curl。
来,最新版本的chrome的javascript调试工具里已经支持Curl复制(它可以完全模拟浏览器访问,包括header,cookie,操作系统信息等),具体是 先打倒network 上,之后访问这个页面 之后在那个list点右键,有个copy as curl。之后直接curl的干活
URL 写错了吧 ... 或者是服务端对 User-Agent 做了限制 ...
用 –user-agent
模拟一下其他浏览器看看 ...

Article chaud

Outils chauds Tags

Article chaud

Tags d'article chaud

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Sujets chauds

Guide d'installation et de mise à niveau de PHP 8.4 pour Ubuntu et Debian

Comment configurer Visual Studio Code (VS Code) pour le développement PHP
