title: Check if URL entered is from a certain domain
body: <p>I have a field where a user can enter a URL. I need to check if that URL is from a certain domain, in this case <code>google.com</code>.</p>
  
  <p>I've tried this, however, it doesn't work for all cases (which I list below):</p>
  
  <pre><code>if(strstr(parse_url($link, PHP_URL_HOST), 'google.com') { // continue }
  </code></pre>
  
  <ul>
  <li><a href="http://www.google.com/blah" rel="noreferrer">http://www.google.com/blah</a> - works</li>
  <li><a href="https://www.google.com/blah" rel="noreferrer">https://www.google.com/blah</a> - works</li>
  <li>google.com/blah - doesn't work</li>
  <li>www.google.com/blah - doesn't work</li>
  </ul>
  
  <p>Is there a way to do this without regex? If not, how would it be done?</p>
  
  <p>Thanks.</p>