Home > Backend Development > PHP Tutorial > curl模拟登陆教务系统陷入重定向循环应该怎么办?

curl模拟登陆教务系统陷入重定向循环应该怎么办?

WBOY
Release: 2016-06-06 20:50:25
Original
1383 people have browsed it

但是重定向的目标网址还是当前页面,后来分析了下发现是发生了重定向循环
PS:本地登陆教务系统之后,用IE浏览器输入目标网站可以直接进入
但是如果用火狐和Chrome就不行,出现重定向循环
显示:Object moved to here.

header信息:

<code>HTTP/1.1 302 Found 
Date: Fri, 26 Apr 2013 00:52:02 GMT 
Server: Microsoft-IIS/6.0 
X-Powered-By: ASP.NET 
X-AspNet-Version: 1.1.4322 
Location: 
Cache-Control: private 
Content-Type: text/html; 
charset=utf-8 Content-Length: 117
</code>
Copy after login
Copy after login

回复内容:

但是重定向的目标网址还是当前页面,后来分析了下发现是发生了重定向循环
PS:本地登陆教务系统之后,用IE浏览器输入目标网站可以直接进入
但是如果用火狐和Chrome就不行,出现重定向循环
显示:Object moved to here.

header信息:

<code>HTTP/1.1 302 Found 
Date: Fri, 26 Apr 2013 00:52:02 GMT 
Server: Microsoft-IIS/6.0 
X-Powered-By: ASP.NET 
X-AspNet-Version: 1.1.4322 
Location: 
Cache-Control: private 
Content-Type: text/html; 
charset=utf-8 Content-Length: 117
</code>
Copy after login
Copy after login

安装 wireshark, 然后截获 IE 的所有请求数据,用 curl 做完整的模拟

让curl递归的抓取http头中Location中指明的url 加上curlsetopt($ch, CURLOPTFOLLOWLOCATION, 1); 试试

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template