Created
December 27, 2020 15:18
-
-
Save bclswl0827/7d0b5ba41136d9d99fa4e30b6f73552c to your computer and use it in GitHub Desktop.
Determine whether the request comes from curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function is_curl(){ | |
$regex_match="/curl/"; | |
return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT'])); | |
} | |
if(is_curl()) { | |
echo 'status=0'; | |
} else { | |
header( "HTTP/1.1 301 Moved Permanently"); | |
header("Location: https://sdrotg.com"); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment