tags:

views:

227

answers:

1

Hi all

I am a beginner and i was wondering can we write a code in PHP by which we can enter keyword in search box of any website and submit.

so there will be 2 inputs to this php function:

function enter_keyword($website_url, $keyword)
{

}

function enter_keyword($website_url, $keyword) { }

It will be a great help thanks in advance

+2  A: 

You will need to supply the url to the search page of every website you want to use this on, and you'll also have to supply the name of the text field which contains the keyword. For example, in;

<form method='post' action='http://site.com/search.php'&gt; 
<input type='text' name='keyword'>

The url is 'http://site.com/search.php' and the name of the field is 'keyword'.

Then, using the CURL library in PHP you can make a GET or POST request to that url.

Click Upvote
You'll also want to match the method of the form on the remote page. I'd always make my search forms GET forms, for example
Gareth