I am attempting to create a function that will check for domain names in the text that is posted and only allow certain domains to pass through the filter. The function should be able to pick up all domains in the certain formats :
site.co.uk
http://www.site.com
www.site.com
site.com
<a href="http://www.site.com">site.com</a>
do not check <img> tags or URLs ending with image extentions
I am wanting to add a list of sites that should be allowed in the following format :
$sitesallowed = array('somesite.com', 'site.co.uk');
Here is the catch. If the string contains any sites that are not allowed, i want to return $sites = 1. If the string contains sites that are allowed, I want to return $sites = 0.
any ideas or coding the may get me pointed in the right direction would be extremely appreciated! I have no idea how to use preg_match so I really need help on this.