Please help me write a regular code-php Tutorial

Source: Internet
Author: User
Please help me write a regular code and get the webpage content through the following code $ connfile_get_contents (ygtc.tmall.com). Then, use the foo () function to process all the contained URLs and put them back to the original location, finally, the foo () function of the webpage is output as follows: function & nbsp; foo ($ url)} $ url is the input url: return & nbsp; md please 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;
}

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.