PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Oct 24, 2017 2:47 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Sep 25, 2017 6:59 pm 
Offline
Forum Contributor

Joined: Wed Jan 18, 2017 4:43 pm
Posts: 171
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:

Syntax: [ Download ] [ Hide ]
$keywords = blah blah;
$url = "http://www.ebay.com";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$url");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
echo "$result";
 


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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group