Pulling Links from the CITW185 index page.

Please read THIS for additional information.

 

CODE FOLLOWS

<?php
    
include('includes/header.php');    
?>     

    <h1>
         Pulling Links from the CITW185 index page.
    </h1>
    
    <p>
        Please read <a href="../parse-links-article.php">THIS</a> for additional information.
    </p>
    
<?php 


    $url 
'http://citw.lcc.edu/~sperlt/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$matchesPREG_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');    
?>