Page 1 of 1

Check if URL is of a specific website

Posted: Fri Aug 13, 2010 4:17 pm
by Edregi
Hello,

I would like to check if a URL a user inputs is from a specific website (ex. If I want it to be from google.com, the URL http://en.wikipedia.org/wiki/ would return false).

I can't figure out how to do this,
Thanks

Re: Check if URL is of a specific website

Posted: Fri Aug 13, 2010 5:49 pm
by db579
Not sure what you want to happen but this could work?

if((strpos($URL,google.com)) != false){
echo "true";
}

Re: Check if URL is of a specific website

Posted: Sat Aug 14, 2010 12:08 am
by arrielmabale
$URL = $_SERVER['HTTP_REFERER'];
if((strpos($URL,google.com)) != false){
echo "true";
}