I need a small PHP-script that logs into an affiliate network account (Clickbank), reads the sales data from an HTML table and stores them in a table in a MySQL database.
The script needs to go through all clickbank accounts stored in a mySQL table and for each account login to the account access the transaction page, read the HTML content and parse the transaction data from the HTML table and store it in a table in the mySQL database.
The script needs to go through all clickbank accounts stored in a mySQL table
and for each account login to the account ([url removed, login to view]),
access the transaction page ([url removed, login to view]),
read the HTML content and parse the transaction data from the HTML table and store
it in a table in the my SQL database. One row in the HTML table will be one row in the database.
Each transaction must be added only once to the DB. Duplicates have to be detected and ignored.
The script will be run daily as a cron job.
PHP Version: 4.4.4
MySQL Version: 4.1.22-standard
In case you don't have a Clickbank account you can create one for free
at [url removed, login to view] and see how these pages look like
After logging in the sales data of a Clickbank account are located on this page:
[url removed, login to view]
Please note that the sales data is on an https page.
The script must only add sales that have not been recorded in the database yet.
To identify a unique sale the script has to look for the uniqueness of these three attributes: Date, Receipt, TxnType and Publisher.
Only if all 4 are identical with an existing sale in the DB the sale is identical and should not be recorded twice.
In the attachement I have provided the database table structure to be used.
The page structure to be parsed:
The field names of the SQL-table basically correspond to the column names of the transaction page.
- id (is auto-incremented by the database)
- account (account name used from account table)
- email (to be found in the href of the Actions column)
- aw (not used - leave blank)
- click (not used - leave blank)
- origin (not used - leave blank)
- account (login)
- pwd (password)
One of the values in the overview is a Dollar-Value which may be positive ($[url removed, login to view]) or negative ($[url removed, login to view]).
This needs to be parsed so that the currency sign is cut off and the actual value is inserted correctly into a SIGNED DECIMAL field
in the table.
I have also provided a sample HTML-page from a real Clickbank account that contains all the transaction types you may encounter: Sales, Refunds, Bounces etc.
For privacy reasons all names and e-mail addresses are altered.
The purpose of this file is to give an idea of how easy or complex the parsing of the table
Please make sure to have a look at the table structure of the transaction source file before bidding.
Before inserting a transaction into the database the script must check if the
value of the TID-field is emtpy. If this is the case the script should
scan the sales table and find any entry that has the same receipt, publisher and email as the one
in question and if that one has a value for TID insert that value into the new transaction.
I will provide you with access to the database and a live clickbank account for test purposes.
Testing and Debugging:
- The script must log all actions it perform to a log file to help detect errors.
- The script must allow a test mode to be set where instead of accessing a live account
it will read the transction data from a file on the server. (This will allow to test all cases without having