|
Posted by sathyashrayan on 07/03/07 12:28
"Giovanni R." <leonida1818@NOSPAMlibero.it> wrote in message
news:2v7k83990eo16p7udud2v67goptnrudhmb@4ax.com...
> On Tue, 3 Jul 2007 13:24:23 +0530, "sathyashrayan"
> <sathyashrayan@REMOVEggmmaaiill.com> wrote:
>
>> If I want to have my own page with a text
>> box and a submit button which searches the google and display those
>> google
>> search result links in my web page. Can that be possible?
>
> You need to set the 'q' var in the query string you pass to google.com.
>
> In your page.php:
>
> ...
> <form action="page.php" ... >
> <input name="str" type="text" />
> <input type="submit" value="Search" />
> </form>
>
> <?php
> if (isset($_POST['str'])) {
>
> $str = $_POST['str'])
> $fh = fopen('http://www.google.co.in/search?q=' . $str, 'r');
> ...
> fclose($fh);
>
> }
> ?>
>
> However, if you have already sent any html (eg. that <form>) you should
> not print out again the <html>, <head>, <body>, etc, html tags coming
> from google.co.in. You should strip them out. Take a look at file() or
> file_get_contents() or, better, see <http://www.google.com/apis/>.
>
Thanks a lot.. it a very useful information. So each search has it's own way
of query string. Is it? yahoo has it own.. altavista has it's own..
wont they change it in the future..?
Navigation:
[Reply to this message]
|