Posted by Iankulov Miodrag on 29 Aug 2008 5:09 pm. Filed under
Google.
Ok, so you know, if you want to search your site with google, you need to go to http://google.com and search like that: query site:your site, but let’s try to make something more awesome and boring :)).For example, I want to put a search box on my blog, how I do this?Well it’s really easy.
<?php
/**
* Google site search
*/
class GoogleSSearch
{
function DoQuery($query)
{
header(”Location: http://www.google.com/search?hl=en&q={$query}+site:ebay.com&btnG=Google+Search&aq=f&oq=”);
}
}
?>
And the html looks like that:
<form action=”http://yoursite.com/your php file” method=”post” accept-charset=”utf-8″>
<label for=”keywords”>Keywords</label><input type=”text” name=”query”/>
<p><input type=”submit” name=”submit” value=”Submit →”></p>
</form>
You can see a live demo here ,don’t forgot to change the {$query}+site:ebay.com& with your site.