Code to read and write to a database on a website

Get help with using AutoHotkey and its commands and hotkeys
omar
Posts: 354
Joined: 22 Oct 2015, 17:56

Code to read and write to a database on a website

11 Jul 2019, 18:45

I want to read a database on a website - I just need to check if a value XYZ exist.

If doesn't exist, write this value to the database.

Else, display a message.

How best to do this?
Use AHK + a simple PHP script?

Has anyone got any code of how to read from the output of the PHP code?
I'm guessing you call it... and then need to wait for a reply?

Thanks.
gregster
Posts: 2500
Joined: 30 Sep 2013, 06:48

Re: Code to read and write to a database on a website

11 Jul 2019, 18:51

Hard to say without any details... but php is mostly used on the server side while you want to automate the browser on the client side (as I understand it).
omar
Posts: 354
Joined: 22 Oct 2015, 17:56

Re: Code to read and write to a database on a website

11 Jul 2019, 20:29

Hard to say without any details... but php is mostly used on the server side while you want to automate the browser on the client side (as I understand it).
Yes :)
That sums it up.

I was hoping someone has done before.
I can do myself - but will be error prone and not robust on things like waiting for a URL to return.

Let me know what you think.

Thanks.
gregster
Posts: 2500
Joined: 30 Sep 2013, 06:48

Re: Code to read and write to a database on a website

12 Jul 2019, 01:17

Like you probably know, you can reliably automate browsers with IE COM, Chrome.ahk or the Selenium webdriver.

Apart from that, I don't know what to recommend with knowing any details, or even the browser...
omar
Posts: 354
Joined: 22 Oct 2015, 17:56

Re: Code to read and write to a database on a website

13 Jul 2019, 04:10

@gregster thanks for the reply.

The way I would intend to use the code...
The AHK code reads a value on the PC. Let's say it reads 12345 as the value.

I need to know if the 12345 value exists on the database or not.
So, I would make a call: www.mydomain.com?id=12345.

The PHP code on my server will then read the 12345 value and look up and return JUST a string:

EXISTS
or
NEW

NEW - meaning that it doesn't exist. (In which case, the code will now add the 12345 code to the database.)

That's all. :)

How best should I do the above?

One consideration (not exactly critically important for immediate) is how to securely access the code on my server and not let anyone who knows the URL to be able to run the code.

Thanks.

Return to “Ask For Help”

Who is online

Users browsing this forum: Flipeador, GaXve, scriptor2016, WilburBr and 232 guests