View Full Version : Retrieving Style info with PHP 5 DOM

11-06-2006, 07:23 PM

I have a situation where I need to determine the width and height of Youtube & Google videos from their embed codes. Ideally I'd like this to be future-proof, so, I think the best way to do this in PHP is using DOM functions. That way if the embed code changes at some point in the future the script will still work.

Youtube & Google Video set their width & height attributes differently: Youtube sets, 'width="somewidth" height="someheight"' whereas Google Video uses the style attribute: style="width: somewidth; height: someheight;"

If I was using javascript this would be relatively straightforward, however in PHP I haven't found a way.

Does anyone out there know how to do this?

Note: I'm using PHP 5.1.4, so I'm using the new PHP DOM system.