How to display content from other sites on my own page?
How does a website like http://www.dogpile.com display search results from Google and other search engines on it's own page. The only way I can think about doing something like this is by using iframes but of course then the content won't really be on 开发者_开发问答my page.
They are using the public api's for the different search engines and building their pages from the results.
See:
Google's Search API
Bing Search API
Yahoo! Search API
Have a look at curl. There are plenty of examples of its usage on that page.
On the server side download the content of their page, make all the relative references absolute, add their head entries to yours, add their body to yours, hope you don't get caught stealing someone else's content.
You could use AJAX, and just consider the remote page as a webservice that returns HTML. That is, just innerHTML it directly into your DOM.
when someone requests a search:
- perform that search for the various search engines on your server
- extract the content with xpaths, regex, etc
- and then display the results on your own webpage
精彩评论