Simple HTML DOM css
I am using Simple HTML DOM to get content from a website. However some of the images do not display because they are set as backdroung images from an external so I have called this in also.
However the image dose not have the full path.
<style>
div.spriteImgSmall { background: url(/images/css_sprites/film_sprites/smallimages_sprite.jpg); }
div.spriteImgSmall_开发者_运维百科17826 { background-position: -0px -0px; width: 86px; height: 64px; }
</style>
There are no head or body tags as this is part of a facebook app. How could I use Simple HTML DOM to add on the base url to the path?
DOM deals with structured HTML, however what you've got there is CSS, which for DOM is just unstructured text. So probably your best approach would be:
- Parse HTML DOM, find style tags
- Take contents of the style tag by using something like
(string)$dom->style
- Parse the content with
preg_match()
, looking forurl(blah-blah)
精彩评论