How to perform a google search from your website


Want to perform a google search from your textbox in your website? Today we'll learn how to do this.

/!\ Make sure you are using php 5.6 or above

Create a file called gsearch.php And add the following content to it
$s = $_POST['s'];
<!DOCTYPE html>
<title>Google search</title>
<form action="gsearch.php" method="POST">
<input type="text" placeholder="Query" name="s">
<input type="submit" name="search" value="Search">

The user enters his search query in this form, wich sends it to the php code, that gets the query, and redirects to


Hope you enjoyed this tutorial, and if it worked for you, give it a thumbs up by clicking the like button.
If you need any more help, you can create a new topic here, and we will be happy to help you!

Note that you can achieve the exact same thing without PHP, but we’re pretending you want to do something with the data before sending the request to Google

1 Like