Jump to content


Photo

Search Function


  • Please log in to reply
2 replies to this topic

#1 Bavilo

Bavilo
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 24 March 2006 - 09:33 PM

Hello,

I was thinking about adding a search field on my site. A field where i just enter some text, click search, and then a new page pops up with the google results of that query. What i need to know is how to append the following: site:http://mysite.com so it actually calls for "blah blah site:http://mysite.com" Can i do this using php?

Thanks
Mike

#2 phpfreak101

phpfreak101
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 24 March 2006 - 11:00 PM

[!--quoteo(post=358064:date=Mar 24 2006, 04:33 PM:name=Bavilo)--][div class=\'quotetop\']QUOTE(Bavilo @ Mar 24 2006, 04:33 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hello,

I was thinking about adding a search field on my site. A field where i just enter some text, click search, and then a new page pops up with the google results of that query. What i need to know is how to append the following: site:http://mysite.com so it actually calls for "blah blah site:http://mysite.com" Can i do this using php?

Thanks
Mike
[/quote]


Ya gotta do some URL hacking

Instead of opening google.com, open up [a href=\"http://www.google.com/search?hl=en&q=my+search+term+site%3Amysite.com\" target=\"_blank\"]http://www.google.com/search?hl=en&q=mysea...te%3Amysite.com[/a]

where

http://www.google.com/search?hl=en&q=
Is part of google's parameters and
my+search+term
Is your search term
+site%3Amysite.com
Specifies to search your domain at mysite.com

you can then use
header("Location: http://www.google.com/search?hl=en&q=my+search+term+site%3Amysite.com"); 
to redirect the browser to your home rolled URL.

#3 scikidus

scikidus
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 September 2008 - 12:48 AM

Hi, sorry for the HUGE bump, but I'm having the same trouble. Call me a complete n00b, but I have no idea how to get this to work. I'm using Dreamweaver, and I'm trying to create a search function based on the same idea. Could someone please lay out exactly what I need to do? I'm clueless. Thanks!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users