Grabbing the href attribute of an A element

前端 未结 10 2393
悲&欢浪女
悲&欢浪女 2020-11-21 05:06

Trying to find the links on a page.

my regex is:

/]*href=(\\\"\\\'??)([^\\\"\\\' >]*?)[^>]*>(.*)<\\/a>/
10条回答
  •  执念已碎
    2020-11-21 06:04

    For the one who still not get the solutions very easy and fast using SimpleXML

    $a = new SimpleXMLElement('Click here');
    echo $a['href']; // will echo www.something.com
    

    Its working for me

提交回复
热议问题