PHP collection program problems

Source: Internet
Author: User
PHP collection program problems
 



These two sections are collected by me. when collecting two product pages, I want the product image address.
Http://ec2.images-amazon.com/images/ I /418Qdk6bctL._SL500_AA280_.jpg
Http://ec2.images-amazon.com/images/ I /51bsLAswKVL._SL500_AA280_.jpg

There are a lot of code on the whole page. I just want this image.
Http://ec2.images-amazon.com/images/ I/
._SL500_AA280_.jpg
Each page of the above two sections is the same. how can I filter the image address I want?


Reply to discussion (solution)

Add id = "prodImage" to distinguish other images.

No
Just http://ec2.images-amazon.com/images/ I/
The address ._SL500_AA280_.jpg is enough, but the numbers in the middle are different. all such addresses on a page are the same image.

Http://ec2.images-amazon.com/images/ I /51bsLAswKVL._SL500_AA280_.jpg
This address is unique on a page, but 51bsLAswKVL in the middle will be different.

Preg_match_all ('# src = "(http: // ec2 \. images-amazon \. com/images/I/[a-z \ d] + \. _ SL500_AA280 _\. jpg) "# is ', $ s, $ m );
Print_r ($ m [1]);

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.