Serait possible avec PHP et une expression régulière pour faire ce qui suit. Obtenez tous les liens hypertexte à l'intérieur d'un contenu et réécrivez-les si le domaine de premier niveau du lien hypertexte correspond à un nom tld donné à partir du tableau.php expression régulière et remplacer
maintenant une expression régulière qui réécrit tous les liens hypertexte dans un contenu donné
preg_replace('/<a(.*)href="([^"]*)"(.*)>/','<a$1href="goto.php?url=$2"$3>', $content);
exemple
$tld = array("http://www.example.com","http://www.test.com");
if <a href="www.example.com">example</a> than <a href="/goto.php?url= www.example.com"</a>;
Utilisez un parseur DOM à la place. – Brad
[Le poney il vient ...] (http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) –
oh l'homme devient compliqué, je perds ma foi. – lgt