Ask the big God whether this can use regular match to the dead or alive can't get out AH

Source: Internet
Author: User
A page has a lot of Weibo a Weibo there are many layers of div I want to get the data for each of the two div's in the microblog:
Text content





These two div's are siblings.
I'm going to catch the contents of class=content and the IMG src;
It is important to take into account that the second div is not required some of the tweets have pictures some don't


Reply to discussion (solution)

Suggest you use Phpquery bar, two days ago looked a bit fine ... After mastering the method, you don't need to think about the regular expressions.

Suggest you use Phpquery bar, two days ago looked a bit fine ... After mastering the method, you don't need to think about the regular expressions.
Really, it's okay. Dochehoun Moderator
There are two more questions that I choose to use. Content to crawl the contents it will display all the content contents of the entire page as a single piece of content, which makes it impossible to distinguish where it is.
And one is how to make it read the next page.
Younger brother New please Huang Moderator


Suggest you use Phpquery bar, two days ago looked a bit fine ... After mastering the method, you don't need to think about the regular expressions.
Really, it's okay. Dochehoun Moderator
There are two more questions that I choose to use. Content to crawl the contents it will display all the content contents of the entire page as a single piece of content, which makes it impossible to distinguish where it is.
And one is how to make it read the next page.
Younger brother New please Huang Moderator


Huang Moderator .... When you have multiple classes, you can take a closer look at the first few.
As to how to read the next page to be based on different pages to do the specific operation ...

Phpquery and jquery Use the same syntax, and jquery will be able to use Phpquery
If you don't know, just go to the Web site and learn.

Suggest you use Phpquery bar, two days ago looked a bit fine ... After mastering the method, you don't need to think about the regular expressions.
Really, it's okay. Dochehoun Moderator
There are two more questions that I choose to use. Content to crawl the contents it will display all the content contents of the entire page as a single piece of content, which makes it impossible to distinguish where it is.
And one is how to make it read the next page.
Younger brother New please Huang Moderator

Think of the Huangdao Lord ... Eastern Evil

  • 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.