Im trying to extract all URLs from an html file.The links I´m interested in have this formatting:
<a style="clear:all;" href="http://www.example.c...le.com">Example Anchor</a>
I´m using this code to extract the URL:
$data = file_get_contents('file.html'); preg_match_all("/<a style=\"clear:all\;\" href=\"(.+?)\"> /", $data, $result); $result = $result; echo $result."<br />";
All I get is the following error:
Notice: Undefined offset: 3 in c:\xxxxx.php on line 9
I´m a newbie to PHP and I´ve been reading about regex and arrays but I can´t seem to find what´s wrong here.I´m thinking it´s the array since the error says something about the offset.I´m just basing this on some code I found that does a similar job to the one I need to do.
Thanks for any help!