-2

I've been having a lot of trouble parsing the DOM of a remote webpage using AJAX. I don't seem to be able to find any example or tutorials demonstrating this procedure.

I basically want to search through the DOM of a remote page, find a tag with a specific id/class, take the inner contents of that tag and print it out on my own page.

If anyone can help i'd appreciate it.

4

2 に答える 2

4

The same-origin-policy browsers have do not allow you to access external pages for security reasons. You need to use e.g. a PHP script on your server to retrieve the external site's HTML. Then you can make an AJAX call to that script instead.

于 2012-11-17T13:33:32.777 に答える
1

You could always use this: http://simplehtmldom.sourceforge.net

Easy to use.

于 2012-11-17T14:21:42.730 に答える