我有卷毛的问题。我想尝试使用卷曲访问蒸汽游戏页面,但我必须通过年龄检查。如何点击按钮以进入游戏页面的问题因为curl无法加载javascript。这是我的代码。
$url = "http://store.steampowered.com/app/312660/";
$file = __DIR__ . DIRECTORY_SEPARATOR . "cookie.txt";
$postData = array(
'ageDay' => '31',
'ageMonth' => 'July',
'ageYear' => '1993'
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13");
curl_setopt($ch,CURLOPT_POSTFIELDS,$postData);
curl_setopt($ch,CURLOPT_COOKIESESSION, true);
curl_setopt($ch,CURLOPT_COOKIEJAR,$file);
curl_setopt($ch,CURLOPT_COOKIEFILE,$file);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
这里有人可以通过Valve实施的年龄验证系统来帮助我吗?无论如何,是否可以使用curl方法单击按钮?谢谢。
答案 0 :(得分:0)
复选框选择和继续按钮单击不提交任何发布数据/表单提交。它只是设置一个cookie并重定向到位置http://store.steampowered.com/app/312660/。
所以在你的curl调用位置http://store.steampowered.com/app/312660/agecheck。设置所需的cookie并调用此URL,您将被重定向到上面的URL,游戏视频开始播放hhtml内容,您将得到回复。
您可以通过设置Cookie来执行相同的操作,以便您可以看到视频播放页面
答案 1 :(得分:0)
以下是示例代码,现在您将获得游戏视频,因为我们强制使用Cookie。所以你不会看到年龄限制屏幕
function querySubjects() {
var query = " \
UNWIND {sparams} AS param
MERGE (s:Subject { sid: param.sid } ) \
SET s = param \
";
var paramsAll = []; // array of objects
for (var i=0; i<sidArray.length; i++) {
// [subjects]
var sid = sidArray[i];
var sparams = {};
sparams['sid'] = sid;
paramsAll.push({
sparams: sparams
});
} // end s++
// --> loop queries
queryNeo(query, paramsAll).then(
function(success){
// -->
queryAttributes();
},
function(error){
// ...
}
);
}
function queryAttributes() {
var query = " \
UNWIND {aparams} AS param
MERGE (a:Attribute { aid: param.aid } ) \
SET a = param \
";
var paramsAll = []; // array of objects
// -----------------------------------------------------------------
// init attributes
var aidArray = [];
for (var i=0; i<sidArray.length; i++) {
var sid = sidArray[i]; // array of keys
var attributes = subjects[sid]; // object of attributes
var attributesArray = Object.keys(attributes);
for (var j=0; j<attributesArray.length; j++) {
var aid = attributesArray[j];
aidArray.push(aid);
} // end a++
} // end s++
// filter out duplicates (works fine)
aidArray = aidArray.filter(onlyUnique);
// -----------------------------------------------------------------
// create queries
for (var j=0; j<aidArray.length; j++) {
// [attributes]
var aparams = {};
aparams['aid'] = aidArray[j];
paramsAll.push({
aparams: aparams
});
} // end a++
// --> loop queries
queryNeo(query, paramsAll).then(
function(success){
// -->
queryWeights();
},
function(error){
// ...
}
);
}
function queryWeights() {
var query = " \
UNWIND {params} AS param
MATCH (a:Attribute{ aid: param.aid } ) \
MATCH (s:Subject { sid: param.sid } ) \
MERGE (s)-[w:WEIGHTED {wid: param.wparams.wid }]->(a) \
SET w = param.wparams \
RETURN a,s \
";
var paramsAll = []; // array of objects
for (var i=0; i<sidArray.length; i++) {
// [subjects]
var sid = sidArray[i];
// [attributes]
var attributes = subjects[sid];
var attributesArray = Object.keys(attributes);
for (var j=0; j<attributesArray.length; j++) {
// ...
var aid = attributesArray[j];
var aweight = attributes[aid];
var wparams = {};
// [weights]
wparams['wid'] = sid + '-' + aid;
wparams['aweight'] = aweight;
paramsAll.push({
sid: sid
aid: aid,
wparams: wparams
});
} // end a++
} // end s++
// --> loop queries
queryNeo(query, paramsAll).then(
function(success){
// <--
console.log('success')
},
function(error){
// ...
}
);
}