473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How To Auto Type In Search Box And Click Search Button ?

Hi,

I want to build a cURL script that auto searches a keyword on any site's search feature.
In this example, imagine I want it to search ebay.com.
How should I code it ?
What is the code that:

1. Types a keyword in the search box;
2. Clicks the search button.

I need the appropriate function names to research on them.

I am stuck at this point:

Expand|Select|Wrap|Line Numbers
  1. $keywords = blah blah;
  2. $url = "http://www.ebay.com";
  3. $ch = curl_init();
  4. curl_setopt($ch, CURLOPT_URL, "$url");
  5. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
  6. curl_setopt($ch, CURLOPT_HEADER, 5);
  7. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  8. $result = curl_exec($ch);
  9. curl_close($ch);
  10.  
So, with my cURL, I have managed to load ebay.com homepage.
Now, I need to tell the cURL to:

A). Find the item (search box) that has the following name attribute or id attribute and type the $keywords value onto it.

name="_nkw";
id="gh-ac";


B). Find the item (search button) that has the following name attribute or id attribute attribute and click it.

id="gh-btn";
value="Search";


I would appreciate any code snippet additions to it by anyone.
I am not that much learned to deal with API. Therefore, need the basic code lines that tell cURL or php how to identify items and type in them or click them. General code.

Thank you very much for your help.
Sep 26 '17 #1
0 1636

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Symphony | last post by:
Hi, All: I am using vb.net developing web application. I am new in web application. My issue is: I have a button "btnCalculateTotal" on a web page (form), click this button, the...
3
by: DC | last post by:
I need help. I've confused myself with all of the things I've tried. I'm trying to modify the exiting Contacts template in Access 2000 to include a search option. To the Contact Entry form I've...
2
by: Danny Wang | last post by:
HI, I have a dialog (window) with a drop-down list and an OK button. When user clicks the drop-down list, the app need to do some calculation and validation, so I put an Text_on_change event on...
0
by: tdixon81 | last post by:
I am developing in .jsp a module designed to be used for a specific user. When that user is logged in, they have a list of subjects that are tied to that user. What I want to be able to do is when...
3
by: Icon Iconoclast | last post by:
Double Click on Button creates javascript instead of taking me to the event handler on the page class. I am using Visual Web Developer 2008. I want to be taken to the Event Handler. What's the...
1
by: fsalido | last post by:
How can i point to record in GridView when i click the button to search for lastname? Im using OLEDB AND VISUAL BASIC 2008. thanks!
1
by: Bbjean | last post by:
How can i create a search button in Microsoft Access 2007 with this corresponding information for the employee Details. IDNO Position Description Unit Description Cluster Description Rank...
0
by: Gabbar | last post by:
It doesn't have id element into second button elements except type, value and onclick; Below is my webUI code <input type="button" value="Download...
0
by: viveksarthak | last post by:
how to make search button for my website for finding anything
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.