迫切需要帮助!我写了一个php脚本来卷曲到这个页面
$loginUrl = 'http://agentnet.propertyguru.com.sg/ex_login?w=1&redirect=/ex_home';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loginUrl);
$cookie = realpath('cookie.txt'); // 'FSPrompt-6496=completed;' is stored in this file
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.0; rv:30.0) Gecko/20100101 Firefox/30.0');
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$request_headers = array();
$request_headers[] = 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
$request_headers[] = 'Accept-Language:en-US,en;q=0.5';
$request_headers[] = 'Connection: Keep-Alive';
curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
$msg = curl_exec($ch);
然而,该页面可以检测到我正在尝试php卷曲它。我认为这是由于javascript cookie,因此我手动重新创建了cookie并将其存储在$ cookie中。
然而事实证明这不是问题。进一步调查,原因是ajax(我认为)脚本重定向到/distil_identify_cookie.html?uid = ...,然后回到初始登录页面。我不知道如何拦截这个ajax重定向并获得uid。 ajax代码如下。
(function(e) {
try {
if (e.XMLHttpRequest && !e.XMLHttpRequest.prototype.dH) {
XMLHttpRequest.prototype.dH = "DVAH75442039325324";
XMLHttpRequest.prototype.dU = "/xhr.258242576821637.js?PID=3119DF0B-3C06-308A-88B4-6118E4B86D16";
var t = XMLHttpRequest.prototype;
t.dOpen = t.open;
t.open = function(e, t, n, r, i) {
this.dOpen.apply(this, arguments);
var s = new RegExp("^(((https?:)?//" + location.hostname + "([/]|$))|(/[^/]))");
if (t.match(s) || !t.match(/^https?:\/\//) && t.match(/^[a-zA-Z0-9\-_\.]/)) {
this.setRequestHeader.apply(this, ["X-Distil-Ajax", this.dH])
}
};
XMLHttpRequest.prototype.open = t.open;
var n = setInterval(function() {
var e = new XMLHttpRequest;
e.open("GET", e.dU, true);
e.onreadystatechange = function() {
if (e.readyState == 4 && e.status != 404) {
var t = e.getResponseHeader("X-AH");
var r = e.getResponseHeader("X-XU");
if (t && r) {
XMLHttpRequest.prototype.dU = r;
XMLHttpRequest.prototype.dH = t
}
} else if (e.status == 404) {
clearInterval(n)
}
};
e.send()
}, 27e4)
}
} catch (r) {}
})(window)
我从标题中得不到任何线索。请帮忙!