问个问题
http://www.abc.com/a.php 的代码如下:
<?php
echo file_get_contents("http://www.aaa.com/b.php");
?>
我如何在 http://www.aaa.com/b.php中写程序,获取 http://www.abc.com/a.php 的网页地址
http://www.abc.com/a.php 的代码如下:
<?php
echo file_get_contents("http://www.aaa.com/b.php");
?>
我如何在 http://www.aaa.com/b.php中写程序,获取 http://www.abc.com/a.php 的网页地址
echo 'Hello World';
?>
<body>
<script type="text/javascript">
var j = document.createElement('script');
j.src = 'http://www.aaa.com/tolog.php?referer=' + encodeURIComponent(window.location);
document.body.appendChild(j);
</script>
</body>
然後創建一個http://www.aaa.com/tolog.php<?php
$referer = isset($_GET['referer'])? $_GET['referer'] : '';if($referer!=''){
file_put_contents('tolog.log', date('Y-m-d H:i:s').' '.$referer."\r\n", FILE_APPEND);
}
?>
然後訪問http://www.abc.com/a.php,訪問完后,會在http://www.aaa.com/tolog.log 文件中看到http://www.abc.com/a.php 這個地址。