PHP simple HTML Dom parser, how parse Javascript?
Well here we go,
Is t开发者_JS百科here a way to parse Javascript with PHP simple HTML Dom parser? I want to parse web content generated by Javascript without a direct way to parse images ...etc because they are created after the Javascript generates it.
Here is the web source code: view-source:http://www.pcbox.com/discos-duros_serial-ata-2---sata2_040507.aspx?ch=00000205110002000212031201fa80376ded0f8f1a2a036267416fe20#productos
and the web: http://www.pcbox.com/discos-duros_serial-ata-2---sata2_040507.aspx?ch=00000205110002000212031201fa80376ded0f8f1a2a036267416fe20#productos
If you check the source the images ...etc are generated by JavaScript so I can't directly parse them. Is there a parser for PHP that can do that?
No. You can only parse the DOM as it exists. You would need an entire javascript engine integrated into the parser in order to do that. I suppose it could potentially be done with other external tools (i.e. handing off to node.js or something and then gettign the final DOM back fro parsing by php) but thats a whole lot of complication.
One could also attempt to make a js analyzer for a specific set of use cases but this is bound to be error prone expecially if the html in question is coming from a site you dont control.
精彩评论