getting all of the image absolute path in a page?

Posted by ryanxu on Stack Overflow See other posts from Stack Overflow or by ryanxu
Published on 2010-06-01T05:25:17Z Indexed on 2010/06/01 5:33 UTC
Read the original article Hit count: 177

Filed under:
|

I am trying to get the src of all of the images in a page. But some pages use absolute paths and some do not. So I am wondering whats the best way to do this?

right now I am using this.

$imgsrc_regex = '#<\s*img [^\>]*src\s*=\s*(["\'])(.*?)\1#im';

preg_match_all($imgsrc_regex, $html, $matches);

© Stack Overflow or respective owner

Related posts about php

Related posts about regex