OK to clarify... http://wookeh.net/csc4900/OAT/test.php
the code is:
<?php
$file = file_get_contents("http://www.uncp.edu/catalog/html/acad_prog.htm");
preg_match_all('~<p class=gened4>(.*?)</p>~is', $file, $genEds);
//$matches will be an array with full pattern match as first element and parenthesized pattern match as second element
echo '<pre>', print_r($genEds, true), '</pre>';
//If there's more than one p tag with class="sample", you can use preg_match_all() instead, to grab the contents of all of them
?>
which grabs all the gen ed courses from a list on another website and puts them all into an array... then from that i have individual files on http://wookeh.net/csc4900/OAT/
like the file http://wookeh.net/csc4900/OAT/art.php
<?php
$file = file_get_contents("http://www.uncp.edu/catalog/html/art.htm");
preg_match_all('~<p class=Coursename>(.*?)</p>~is', $file, $matches);
//$matches will be an array with full pattern match as first element and parenthesized pattern match as second element
echo '<pre>', print_r($matches, true), '</pre>';
//If there's more than one p tag with class="sample", you can use preg_match_all() instead, to grab the contents of all of them
$file2 = file_get_contents("http://www.uncp.edu/catalog/html/art.htm");
preg_match_all('~<p class=Coursedescription>(.*?)</p>~is', $file2, $matches1);
//$matches will be an array with full pattern match as first element and parenthesized pattern match as second element
echo '<pre>', print_r($matches1, true), '</pre>';
//If there's more than one p tag with class="sample", you can use preg_match_all() instead, to grab the contents of all of them
//start an empty array.
$finalArray = array();
//loop through the courses.
foreach($matches[1] as $key=>$value){
//assign matching 'Course' and 'Description' values.
$finalArray[$key]['Coursename'] = strip_tags($value);
$finalArray[$key]['Description'] = strip_tags($matches1[0][$key]);
}
//display the final array.
print_r($finalArray);
//these arrays should be similar to the ones you posted
$courses = $finalArray;
$data = '';
foreach ($courses as $chunk) {
foreach ($chunk as $course) {
$data .= "$course\r\n"; //windows line break at end of each line
}
}
$handle = fopen('art.txt', 'w'); //if file exists, truncate it, else attempt to create it
fwrite($handle, $data);
fclose($handle);
?>
Which reads another document and combines the class like
ART 1010. Elements of Design
and combines it with its description...
A study and application of design principles in creative two‑dimensional projects in line, value, color and texture. Credit, 3 semester hours.
then it outputs the class with the description in a seperate text file..
http://wookeh.net/csc4900/OAT/art.txt
now what i want to do is check http://wookeh.net/csc4900/OAT/test.php which is the original gen ed files.. like in this example check the http://wookeh.net/csc4900/OAT/art.txt for the class ART 2020 Introduction to Digital Arts and output in a new file the class and its description.. but for all the defirrent gen eds...