Connect to other websites using php

Hi,
If we give any word to search engine we get the required results.But is it possible to send a word as input to the search engine through php coding.

Many search engines provide an API for this, a quick (pardon the pun) search should help out.

Search APIs - using probably the most celebrated use of just adding GET commands to build a search string. :wink:

the algorithms with API searches are the best

Simpler way can be used for search engines like Google. Simply create an HTML form with an input text field and submit button and send the search string in GET method to the search result page. An example code for Google Search using plain HTML is given below.


<form method="get" action="http://www.google.com/search">
<input type="hidden" name="hl" value="en" />
Text To Search : <input type="text" name="q" />
<input type="submit" value="Search" />
</form>

Hi,
Thanks for ur reply.We can post a keyword to google usign the method you have suggested(Form).How to retreive the result using the coding.I need first 5 results(Links).

Although I’m not sure, but I think you’re not allowed to parse Google Search Result page and retrieve the listed links in any form, or for any purpose. So, you’ve to use Google Search API to retrieve Google Search results and use it in your own way. The way I’ve shown is for implementing a simple Google search page on your site. But you should not parse the search result page of Google, instead of using Search API. View the API docs here Developer's Guide - Google Web Search API - Google Code although Google claims that this is the deprecated version of API.