This will explain how to build a BOT that will automatically enter new users
to "the system".
All work based on the book: Webbots, Spiders, and Screen Scrapers.
The website for this book is here. The website contains the libraries to be
used by the bot and test pages for building bots.
This is what I've done and what needs to be done.
You will need to build a little website to make this happen. I installed XAMPP
lite on my laptop and built a structure like this:
The botlib directory contains the libraries from the website/book mentioned
above. The directory "tim" contains the bot in development.
You will need to enable the curl module in your php installation. This is done by
uncommenting the line in your php.ini file and then bouncing your webserver so
that the new settings are loaded. (The line to uncomment is:
extension=php_curl.dll You just need to remove the ';'.
You will need to create the program "diag.php" in the form directory. This
program will do the diagnostics to help you create the bot. It reports what the
form is sending back to the server. That's our goal - to emulate that data. The
source is located at j15a/bot/steve.
I've already done this, but for your understanding, it's good to know what I did.
The drill was to go to this page on the site and select the "Add User" feature.
This creates a page with tabs for data entry. You then do a "save page as" -
to make an html file. Next, you edit that file to point to your diagnostic tool.
The key line in the capture is:
<form action="http://localhost/form/diag.php" method="post"
name="adminForm" id="adminForm" onsubmit="http://localhost/form/diag.php" autocomplete="off">
Because this displayed form uses "Tabs" you will need to go through and set all the
required values to something. It is not easy as you have to do a careful search and
set the values. After setting the required values and changing the "action" it's time
to do the diagnostics.
Load the form you just edited into your browser, you will see all the required values
preset. You then must select the "save" function.
Now you need to write a script to emulate the form above. [This is where I ran out of
gas(time, stamina). ] My code is called tim.php and is in the j15a/bot/steve directory. I
stopped working last night when I discovered I had to set an array within an array and
forgothow to do it. Just read the documentation... trial and error should get it done.
Ultimatelyyou want to write a script with the action pointing to the diag.php script and
the results will be exactly like you got from the test form above.
Your bot will not work unless this is done properly.
You may need to include a cookie from the website for it to accept the data. You
will need to use a utility to get that from your login - edit your bot script - then run
it to update the data. You should only need to change the "action" of the form to
point to the URL that captured the form originally.
Your proof that "it works!!" will be to log into the system with your
username/password that the bot created.
Reading the user data from a table and looping would be a nice way to do this.
The ticket is complete... start filling out invoices for Tim while it runs.
November