Forum Moderators: coopster
$match_result =
preg_match_all('/<\s*a\s*href=\"([^\"]+)\"\s*id=r-[0-9]_[0-9]([^\"]+)>/i',
$page_contents,
$match_array,
PREG_SET_ORDER);
foreach ($match_array as $entry) {
$href = $entry[1];
$anchortext = $entry[2];
foreach ($match_array as $entry) {
$href = $entry[1];
$anchortext = $entry[2];
$query = "INSERT INTO elements (eid, href, anchortext) VALUES (NULL, '$href', '$anchortext')";
mysql_query($query);
}
You might want to add some error checking, and "or die" clause or something like that, but that should give you the basics.