Re: How to get all links from a webpage?
| From: | Wudi | Date: | Mon, 26 Jul 2004 06:46:59 +0000 |
| Subject: | Re: How to get all links from a webpage? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-191867@lists.php.net to get a copy of this message | ||
On Mon, 26 Jul 2004 11:44:04 +0800
Jason Wong <php-general@gremlins.biz> wrote:
> On Monday 26 July 2004 10:05, Wudi wrote:
>
> > Thank you. I have found a method to get links. But it's slow.
> > The script replaced the links, marked it.
> > And then foreach() all texts were marked.
> > But the blank space always make troubles.
>
> As you haven't posted any code nor described the problem in any detail I can
> only take a wild guess that you want to take a look at urlencode(),
> rawurlencode().
I read perlre just now, it's very long and very complex.
Now, I can use the following script to parse link tags:
$html = preg_replace("/(<A )([^>]+)(>)([^<]+)(<\/A>)/e",
"\$this->ParseTagA(\"$2\", \"$4\")", $html);
It works well and fast.
I use "%20" and "%3D" replace " " and "=" to remove the
problem about
blank space and equal sign.
--------------------------------------------------
Comment: English is not my first language.
Wudi <wudicgi@yahoo.de>