Con diversi tentativi di prove sono riuscito a trovare il modo di recuperare i link dal testo...
Soluzione:
Codice PHP:
preg_match_all("/<a.*?href=[\"|\'](.*?)[\"|\'].*?>.*?<\/a>/", $testo, $arrLinks);
echo "<pre>";
$k = 0;
# Stampa interi tag <a></a>
while ( count($arrLinks[0]) > $k) {
echo htmlspecialchars($arrLinks[0][$k])."\r\n";
$k ++;
}
# Output_1: [url="primo.html"]Primo Collegamento[/url]
# Output_2: [url="secondo.html"]Secondo collegamento[/url]
# Output_3: <a title="ThisIsDesc" href="terzo.html" >Terzo Collegamento</ a>
$k = 0;
# Stampa solo il link (url) del tag <a></a>
while ( count($arrLinks[1]) > $k) {
echo htmlspecialchars($arrLinks[1][$k])."\r\n";
$k ++;
}
# Output_1: primo.html
# Output_2: secondo.html
# Output_3: terzo.html
echo "</pre>";
Ho postato la soluzione pensando che forse sarrebbe utile magari a qualcuno che ha lostesso problema che avevo io...
Alla prossima...