Skip to content

Instantly share code, notes, and snippets.

@nahakiole
Last active April 2, 2018 07:43
Show Gist options
  • Save nahakiole/843fb9a29292bfcf012b to your computer and use it in GitHub Desktop.
Save nahakiole/843fb9a29292bfcf012b to your computer and use it in GitHub Desktop.
Check user agent for curl or wget
<?php
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/(curl|wget)/i", $_SERVER['HTTP_USER_AGENT'])) {
/*
Request is made with curl or wget (Or with modified user agent header)
*/
}
//Regular request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment