My requirement is to lookup all the CSS content (external, internal and inline) from a given URL for some specific CSS content. I am currently using the ‘PHP Simple HTML DOM Parser’ to lookup HTML. But is there a specific way I can achieve this for CSS, specifically, all types of CSS ?
Thanks in advance 🙂
It is possible to gather all CSS a HTML document includes (
styleattributes and elements) and links (linkelement, type CSS).However, as far as I know, some CSS parser in PHP exists so far (but no interface to CSSOM). So you would be able to gather all CSS, but you would need to write/integrate a parser for CSS on your own.
Keep in mind that some sites use things like less which is then turned into CSS via javascript, so you might want to integrate less into PHP as well. Same applies for other, client-side CSS technologies.