利用JS呼叫PHP實現文字版網站瀏覽紀錄抓取( 自製GOOGLE簡易GA )
利用JS呼叫PHP實現文字版網站瀏覽紀錄抓取( 自製GOOGLE簡易GA )
<?PHP /* <script type=”text/javascript”> var data=location.href; var url=”http://127.0.0.1:8080/jpv/js_php_visitors.php?action=”; var aaa = url+data document.write(“<script language=\”javascript\” type=\”text/javascript\” src=\”” + aaa + “\”><\/sc” + “ript>”); </script> */ if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) { $ip = $_SERVER[‘HTTP_CLIENT_IP’]; } elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) { $ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; }else { $ip = $_SERVER[‘REMOTE_ADDR’]; } //– $action= $_GET[“action”]; //– $fp=fopen(date(‘Y-m-d’).’.txt’,”a+”); fprintf($fp,”%s,%s,%s\n”,$ip,$action,date(‘H:i:s’)); fclose($fp); ?> |