Pulling Links from the CITW185 index page.
Please read THIS for additional information.
<?php
include('includes/header.php');
?>
<h1>
Pulling Links from the CITW185 index page.
</h1>
<p>
Please read <a href="https://citw.lcc.edu/~sperlt/citw185/parse-links-article.php">THIS</a> for additional information.
</p>
<?php
$url = 'http://citw.lcc.edu/~eckfordd/citw185/index.php';
$input = file_get_contents($url);
// NOTE the regular Expression below (Please read about this patern in the THIS page above )
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
if(preg_match_all("/$regexp/siU", $input, $matches, PREG_SET_ORDER))
{
echo('<p>');
foreach($matches as $match)
{
if ($match[0] == "<a href=\"#\"></a>")
{
break;
}
// $match[0] = link with anchor (i.e., <a href="index.php">Home</a>)
// $match[1] = "
echo("$match[2] : $match[3] <br>");
}
echo('</p>');
}
include('includes/footer.php');
?>