在学校中,网站上有块。我打算取消这一点。即使我不这样做,我也喜欢这个主意。所以:我有一个PHP页面(source.php)来获取任何网站的源代码(没有跨站点AJAX)。使用php重新创建网站
<?php
echo file_get_contents(urldecode($_GET["url"]));
?>
<script>
if(document.getElementsByTagName("base")[0])
document.getElementsByTagName("base")[0].href="<?php echo $_GET["url"] ?>";
else
document.head.appendChild(document.createElement("base").href="<?php
echo $_GET["url"] ?>");
</script>
简单。这里是index.html的
<html><head><title>Unblocker</title></head><body>
<div width="100%" height="10%">
<form onsubmit="return go()">
<input id="url" value="http://www.google.com/">
<input type="submit" value="Go">
</form>
</div>
<div width="100%" height="90%">
<iframe src="http://www.google.com/" width="100%" height="100%" id="frame">
</iframe>
</div></body></html>
现在的JavaScript(被插入头部标签)
function go(){
url=document.getElementById("url").value;
frame=document.getElementById("frame");
//do some url validations, not posting cause doesn't matter
if(url.isValid)//example
frame.contentWindow.location=location.protocol+"//"+location.hostname+"/
source.php?url="+url;
return false;//to prevent page reload
}
几件事情:首先,这是合法的,同时整个源代码,并显示他们尽管我的意图好?此外,它会工作,还是有什么明显的,可以使它更好?我知道服务器端不能被过滤(假设这个站点没有被阻止!)。我知道这是非常有限的,但我可能能够扩大它,以允许点击链接和所有。
为什么不只是使用代理服务去查看网站? – Nick 2012-01-27 09:56:36
这是你需要用编码实现的东西吗?你不只是使用公共代理服务器,只是配置浏览器使用它? http://www.publicproxyservers.com/ – 2012-01-27 09:57:55
你真的对合法性感到困扰,因为你说你的整个目的是为了规避某人的规则? – DaveRandom 2012-01-27 10:04:01