Bavilo Posted March 24, 2006 Share Posted March 24, 2006 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? ThanksMike Quote Link to comment Share on other sites More sharing options...
phpfreak101 Posted March 24, 2006 Share Posted March 24, 2006 [!--quoteo(post=358064:date=Mar 24 2006, 04:33 PM:name=Bavilo)--][div class=\'quotetop\']QUOTE(Bavilo @ Mar 24 2006, 04:33 PM) [snapback]358064[/snapback][/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? ThanksMike[/quote]Ya gotta do some URL hackingInstead 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 [code]http://www.google.com/search?hl=en&q=[/code]Is part of google's parameters and[code]my+search+term[/code]Is your search term[code]+site%3Amysite.com[/code]Specifies to search your domain at mysite.comyou can then use[code]header("Location: http://www.google.com/search?hl=en&q=my+search+term+site%3Amysite.com"); [/code]to redirect the browser to your home rolled URL. Quote Link to comment Share on other sites More sharing options...
scikidus Posted September 11, 2008 Share Posted September 11, 2008 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.