检查其他网站使用php重定向的次数?

时间:2017-12-13 12:04:27

标签: php

for ex:google pagespeed insights 点击

here

我们如何计算在php中使用其他页面的页面重定向? 我已经尝试了很多但没有得到任何东西。请帮帮我

1 个答案:

答案 0 :(得分:0)

首先使用此代码或类似代码制作track.php:

if(isset($_REQUEST["url"])) {
    $url = $_REQUEST["url"];
} else {
    // Error url is not set
    exit();
}
// Your count code here to store in database
$mysqli = new mysqli("server", "user", "password", "database");
$url = $mysqli->real_escape_string($url); // For security
$mysqli->query(sprintf("INSERT INTO tracks ('%s');", $url));

// Redirect
header("Location: " . $url);

现在您可以这样调用您的网址:http://yoursite/track.php?url=https://developers.google.com/speed/pagespeed/insights/