Skip to content

Instantly share code, notes, and snippets.

@bclswl0827
Created December 27, 2020 15:18
Show Gist options
  • Save bclswl0827/7d0b5ba41136d9d99fa4e30b6f73552c to your computer and use it in GitHub Desktop.
Save bclswl0827/7d0b5ba41136d9d99fa4e30b6f73552c to your computer and use it in GitHub Desktop.
Determine whether the request comes from curl
<?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