English 中文(简体)
How to include Google Search results on a webpage
原标题:

I m doing a webpage about apples (the fruit), I want to include Google search results for apple recipes on the bottom of the page. How can I do this?

最佳回答

You can accomplish this using iframes, but you might want to consider some alternatives... you might want to create a Google Custom Search Engine to serve results only from recipe websites. And, instead of using a frame to display results, you might want to simply make the custom search engine available, so that, only if a user is interested in finding a recipe, he/she may do so. Something else to consider... you might want to monetize this, in which case using Google AdSense would be the way to go.

<iframe src="http://www.google.com/search?q=apple+recipe" />

If you want to use an iframe, you can use the code above; however, this is not a good design decision.

问题回答

For more advanced inclusion of Google results check out this: https://developers.google.com/web-search/docs/#fonje

You can use ajax based search queries for your keywords and put the results on your website. There are examples in the docs

Update:
As the API is deprecated you can now alternatively just scrape the results from Google instead of using their API. There is an open source PHP scraper that can be included into your website at http://scraping.compunect.com

<a href="http://www.google.com/?q=apples">See recipes about bananas</a>.




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签