PHP Get all hyperlink functions on a page_PHP tutorial

WBOY
Release: 2016-07-13 17:40:45
Original
1144 people have browsed it

Simple function to get all hyperlinks on a page:

  1. function get_all_url($cnstr){
  2. preg_match_all(/" ] )["|]?s*[^>]*>([^>] )/i,$cnstr,$arr);
  3. return array(name=>$arr[2],url=>$arr[1]);
  4. }

  5. //Call function
  6. $url = www.ite5e.com;
  7. echo get_all_url($url);
  8. ?>

It’s very simple to use, just pass in a URL address.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486187.htmlTechArticleA simple function to get all hyperlinks on a page: ?php function get_all_url($cnstr){ preg_match_all(/as href=["|]?([^" ] )["|]?s*[^]*([^] )/a/i,$cnstr,$arr); return array(name...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!