title: Checking PHP referrer
body: <p>So, I need to check the referrer to a page using php, and if it is *.example.com, or *.anothersite.com, execute code, but if not, redirect elsewhere.</p>
  
  <p>How would I go about checking if the HTTP_REFERER is equal to those values, with a wildcard character?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: The url will contain more than one domain, so the regex needs to match the FIRST occurance found.</p>