Ask the experts to help write a regular code get the content of the web page through the following code $ conn = file_get_contents ("http://ygtc.tmall.com"); then all the content with http: // after the URL is processed by the foo () function, put it back to the original location. Finally, the foo () function of the webpage is output as follows. fu, ask the experts to help write a regular code.
Obtain the webpage content using the following code:
$ Conn = file_get_contents ("http://ygtc.tmall.com ");
Then, use the foo () function to process all URLs with http: //, put them back to the original location, and finally output the webpage.
The foo () function is as follows:
Function foo ($ url )}
// $ Url is the input url
Return md5 ($ url); // here is simply the processing method of the function. In fact, the processing method is not so simple, just as an example;
}
------ Solution --------------------
$ Conn = file_get_contents ("http://ygtc.tmall.com ");
Echo preg_replace_callback ('/(
Function foo ($ url ){
Return $ url [1]. md5 ($ url [2]); // Here we simply write the processing method of the function. In fact, the processing method is not that simple, just as an example;
}