I want to essentially strip out everything from an html document except the links. I want to place these links into an array as well.
I have this so far, but it is not placing each link on a seperate line, rather it seems to be in one long line:
Essentially, I figure the page would be loaded into a variable (array), split up of elements - finding all links and then stripping everything in between links. Finally, those links would be separated into different lines and used for output.
Thanks for everyone's help with this!
Business Identity and Web Development Services
I have this so far, but it is not placing each link on a seperate line, rather it seems to be in one long line:
Code:
$lines = file("index.html");
$html = join("",$lines);
// remove all line breaks
$html = str_replace("\n","",$html);
// and put in a new line break behind every anchor tag
$html = str_replace("</a>","</a>\n",$html);
// split the string into single lines
$lines = split("\n",$html);
Essentially, I figure the page would be loaded into a variable (array), split up of elements - finding all links and then stripping everything in between links. Finally, those links would be separated into different lines and used for output.
Thanks for everyone's help with this!
Business Identity and Web Development Services