Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to Code cURL PHP Script to Auto Type In Search Box & Click Search Button?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.04k
    Answer it


    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
    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:


    $keywords = blah blah;
    $url = "";
    $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);

    So, with my cURL, I have managed to load 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.



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


    I would appreciate any code snippet additions to it by anyone.

    Thank you very much for your help.

 0 Answer(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: