PHP hyperlink capture implementation code. Common HTML standard hyperlink parameters get regular expression test because recently I want to do something similar to a professional search engine, I need to capture all the hyperlinks on the web page. Let's take a test of obtaining regular expressions for common HTML standard hyperlink parameters.
Because I recently want to create something similar to a professional search engine, I need to capture all the hyperlinks on the web page.
Let's test whether the following code can target all the standard hyperlinks.
The test code is as follows:
The code is as follows:
//--------------------------------------------------------------------------
// File name: Noname1.php
// Description: Test the regular expression for obtaining common link parameters.
// Requirement: PHP4 (http://www.php.net)
// Copyright (C), HonestQiao, 2005, All Rights Reserved.
// Author: HonestQiao (honestqiao@hotmail.com)
// Parameter description:
// $ StrSource: HTML webpage with standard link
// $ StrResult: processing result
// Additional description:
// The standard link and the link contained in the usage 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.
Because I recently want to create something similar to a professional search engine, I need to capture all the hyperlinks on the web page. Let's test it...