I have a problem with this works what I want to do is the following I want to look for the data of the link but not to give me an error information along with the correct one and if there is no data I get an error message
function External_links($Link_info){
$content = '
"url_line":"/youtube.com(.+)v=([^&]+)/";
"url_line":"/vimeo.com\/([a-z1-9.-_]+)/";
"url_line":"/facebook.com\/[a-z1-9.-_]+/";
';
if (preg_match_all('#"url_line":[^"]*"([^"]*)"#', $content, $resultado)) {
$mp = $resultado[1];
} else {
$mp = ['sin coincidencias']; // este mensaje de error
}
foreach ($mp as $nombre) {
if(isset($Link_info)) :
$url = $Link_info;
if(preg_match($nombre, $url)) {
//=== youtube information generator
echo 'yes <br>';
}else{
//-- Error 404
echo 'no funciona <br>';
}
endif;///
}
}
echo External_links('https://www.youtube.com/watch?v=OawLX0jVRVU');