Capture url and webpage content-php Tutorial

Source: Internet
Author: User
Because the technology is not enough to capture URLs and webpage content, I am visiting the forum all day. I can see a lot of information about crawling webpages (file_get_contents) and crawling URLs (I don't know what to use. What's going on? It is best to help me with the entire source code. For more information, see. Capture url and webpage content
Due to insufficient technology, I spent all day on forums. I can see a lot of information about crawling webpages (file_get_contents) and crawling URLs (I don't know what to use. What's going on? It is best to help me with the entire source code. For more information, see.

Share: More


------ Solution --------------------
$ Url = 'http: // www.iheima.com /';
$ Con = file_get_contents ($ url );
If ($ con ){

Preg_match_all ('/(. +) <\/a> .*

(. +) <\/P>/isU ', $ con, $ temp, PREG_SET_ORDER );
Foreach ($ temp as $ key => $ v ){
$ Title = $ v [2];
$ V_url = $ v [1];
$ Des = $ v [3];
$ Con_url = file_get_contents ($ v_url );
If ($ con_url ){
$ Tags = '';
Preg_match ('/keywords "content =" (. +) "/isu', $ con_url, $ tags );
$ Tags = trim ($ tags [1], ',');

Preg_match ('/class = "txs_Content". *> (. +) <\/p>/isU', $ con_url, $ txt );
$ Txt = $ txt [1];
}

}
} Is it clear enough?

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.