0

Well here we go,

Is there 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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.