Re: Get links from a page
| From: | lallous | Date: | Fri, 07 Dec 2001 13:46:38 +0000 |
| Subject: | Re: Get links from a page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77041@lists.php.net to get a copy of this message | ||
this should work,
if (preg_match_all('/<a .+?href=([\'"])(.+?)\1/is', $mem, $result))
{
$linksarray = $result[2];
}
"Julio Nobrega Trabalhando" <inerteARROBAhotmail.com@pb1.pair.com> wrote in
message news:20011207130948.44525.qmail@pb1.pair.com...
> Hi all,
>
> I was sure I saw something like this on this list one month ago. But I
> search for like dozens of word combination to find this post (or anything
> related to), and was unsuccesful.
>
> Anyone has a quick snippet that will scan a bunch of text characters and
> return the links as an array element?
>
> Something like:
>
> text to search:
> <a
>
href="http://www.stj.gov.br/stj/noticias/detalhes_noticias.asp?seq_noticia=4
> 776">Proprietário que retoma imóvel negociado responde pelas despesas
> condominiais atrasadas</a> <a
>
href="http://www.stj.gov.br/stj/noticias/detalhes_noticias.asp?seq_noticia=4
> 775">Ouro Preto garante no STJ o recebimento de parcela de ICMS da Vale do
> Rio Doce</a>
>
>
> And it could return:
> $array = Array();
> $array[] =
>
'http://http://www.stj.gov.br/stj/noticias/detalhes_noticias.asp?seq_noticia
> =4776';
> $array[] =
>
'http://www.stj.gov.br/stj/noticias/detalhes_noticias.asp?seq_noticia=4775';
>
> Thanks a lot, and again sorry if this is a duplicated question, but I
> really did not find.
>
> --
>
> Julio Nobrega
>
> Don't eat the yellow snow.
>
>