I'm doing a php validator initially with a simple function.
$url = $_POST['url'];
$estado;
$amp = file_get_contents("$url");
$buscar = "/amp";
$resul = strpos($amp, $buscar);
if($resul!= false){
$estado= 'La página existe!';
}else{
$estado= 'La página no existe :(';
}
echo $estado;
what the function does is to look for this tag in the code of a page
<link rel="amphtml" href="https://dominio.com/amp/version-mobil-de-la-pagina">
if you find it, it means that this page has an amp version available. but I would like you to also throw me only the link of that version, that is:
https://dominio.com/amp/version-mobil-de-la-pagina
I have no idea how to implement it maybe with regular expressions, but I do not know how to start, thanks in advance.