怎么用js代码修改referer的值?

来源:百度知道 编辑:UC知道 时间:2024/09/24 23:41:28
想在提交表单时修改referer的值。或者我能不能把我上一次的请求以某种方式存起来然后在一段时间之后,比如几小时后,再重新发一遍一样的请求,包括http头
好像没有人知道,现在仅有的答案好像是骗分的。。。郁闷

给你一段PHP代码片段,我目前正在使用的,几乎不用修改,可以直接使用。第一次回答技术帖。

<?php

$url='XXX';//这里填写url
$cookie='XXXXXXXXX'; //COOKIE值
$post_data=''; //post数据
$useragent='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; MAXTHON 2.0)';

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_REFERER, "");//引号内填写你需要写的referer值
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_COOKIE,$cookie);
curl_setopt($ch, CURLOPT_USERAGENT,$useragent);
$result = curl_exec($ch);
?>