I have problem with this code:
$parse = parse_url($url); //$url is POST from input field
$urls = $parse['host'];
$domain = array('mydomain.com', 'mydomain.net');
if (!in_array($urls, $domain)) {
echo 'invalid URL';
}
Checking url, if not in array, give error if yes continue.... I see all similar thread but no one fix my problem.
P.S the problem is: Only give Invalid URL (in case when url is correct and in case when URL is wrong)
e.x url: mydomain.com/u/123-test
need to be valid url