sabiandrummer123
68.***.***.***alternative to "strpos"
I'm trying to read a remote file and display a list of all the links in that page's source code.For Example, I want to read "http://www.google.com" and get
HTML code:
1. <a href="example">Web</a>
2. <a href="example">Images</a>
3. <a href="example">Video </a>
So far I've been able to this for ONE of the links like this:
PHP code:
$source=Google Source Code;
$startTag="<a";
$endTag="</a>";
$pos1=strpos($source,$startTag);
$pos2=strpos($source,$endTag);
$result=substr($source,$pos1,($pos2-$pos1)+strlen($endTag));
So in that case "$result" is just what I want it to be. EXCEPT I cant figure out how to get ALL of the links listed and not just the first one.
Any help would be greatly appreciated. Also, I'm a beginner so if my code looks sloppy to you feel free to give me pointers in that area as well.