What is a hyperlink to a PHP hyperlink fetch implementation Code

Source: Internet
Author: User
Generic HTML standard hyperlink parameter get regular expression test
Because I'm going to do something like a professional search engine recently, I need to crawl all the hyperlinks in the web.
Everyone help test all of a sudden, the following code can be for all the standard hyperlinks.
The test code is as follows:

Copy the Code code as follows:


// --------------------------------------------------------------------------
File name:Noname1.php
Description: Generic link parameter get regular expression test
REQUIREMENT:PHP4 (http://www.php.net)
Copyright (C), Honestqiao, 2005, All rights Reserved.
Author:honestqiao (honestqiao@hotmail.com)
Parameter description:
$strSource: HTML pages that contain standard links
$strResult: Results of processing
Additional Instructions:
Standard links, using the links contained in the situation
// --------------------------------------------------------------------------
$strSource = <<t1
T2
T3
T4
HTML;
Preg_match_all ('/(. +?) <\/a.*?>/sim ', $strSource, $strResult, Preg_pattern_order);
for ($i = 0; $i < count ($strResult [1]); $i + +)
{
printf ("%d href= (%s) title= (%s) \ n", $i, $strResult [1][$i], $strResult [2][$i]);
}
?>


If your test data conforms to the standard link, but is not processed here, please let me know the test data and your test environment.
Thank you.

The above describes what is a hyperlink to the PHP hyperlink crawl implementation code, including what is the content of hyperlinks, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.