RE: [PHP] PHP gurus...how are they doing this?
| From: | Graham Cossey | Date: | Mon, 11 Oct 2004 13:26:04 +0000 |
| Subject: | RE: [PHP] PHP gurus...how are they doing this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199164@lists.php.net to get a copy of this message | ||
[snip]
>
> This is how far I have come trying to imitate the
> above: (Its not working of course :-) )
>
> <?php
> $url=fsockopen('http://www.jumac.com/');
> $html = implode('', file("$url")); //put the page
> source in a string
>
> //find the links and put them in an array
> $links = array();
> if (preg_match_all('/<a\s+.*?href=[\"\']?([^\"\'
> >]*)[\"\']?[^>]*>.*?<\/a>/i', $html, $matches))
> {
> foreach($mathes as $match){$links[] = $match;}
If this is a copy&paste of your code you may want to change the above line
to:
foreach($matches as $match){$links[] = $match;}
^
[snip]
Graham