Jump to content

Simulate keystrokes from PHP script


AndyG

Recommended Posts

I am a novice. My knowledge is based on IT classes I took in high school and on what I could find on Google. Nevertheless I managed to scrap up a PHP script in connection with a database I set up on Apache2.

In simple terms, the script takes info from the database and sends it to a website. Everything works fine, but I want to make things easier by sending a 10 digits code via simulated keystrokes to the website:

  • access website
  • wait for page to load
  • send 10 digit code + Enter

I'm trying to do this both for Windows 10 and Linux. On linux, thus far I've stumbled in permission issues for xdotool, and implementing the "wait for page to load".

On Windows 10 I'm clueless since sendkeys no longer works with Windows 10.

Thank you for your help.

Link to comment
Share on other sites

Thank you all for your answers. I will definitely look into cURL.

The script should do the following things:

  • take specific information from a local database - DONE
  • accordingly to the information selected, will activate several local physical locations (lockers, doors etc) - DONE
  • send specific information (related to which door was accessed) to a website - the 10 digit code+Enter - IN PROGRESS

This website that I'm trying to access is owned by a different company. It is usable now by inputting this 10 digits code+Enter(they used access cards before). I know that the easiest way would be for them just to change the input method to something like accessing "www.example.com/code", but that would cost a lot of money.

So in fact my question is, should I just pay the money, or is there an easy way to do this as things stand now.

Thank you again for your answers ?

Link to comment
Share on other sites

55 minutes ago, requinix said:

If it's on a website then it uses HTTP to send and receive data. You can do the exact same thing with cURL.

Yes, it's on website, as per original OP's message - the script takes info from the database and sends it to a website

It's the main reason I suggested him curl.

 

Link to comment
Share on other sites

I don't think cURL is usable in my situation.

I think there's a misunderstanding, so I'll try to explain things better. All of this is related to a kiosk app tracking employees status. I'll give you an example:

  • Jack comes to work 08:00, he checks in with the kiosk app
  • the app recognizes his credentials and starts the automation process accordingly
  • the app accesses a specific website, waits for it to load, then types in the 10 digit code+Enter related to Jacks credentials
  • then Jack has to undergo specific checks on that website, but that's not my problem anymore.

So everything happens on the same computer.  The script opens the website, waits for it to load, types the code - all of this while the user is in front of the PC seeing everything.

Before, we had just the website where people used access cards to login. Now I want to bypass those access cards, so I need something to simulate keystrokes. Probably you know that when swiping access cards you actually just type a code+Enter.

This website login is quite simple. It's just a page, you use the access card and you login. I can take the access card, swipe it with notepad open. Copy/paste that code into the site+Enter, and it works. Or type the code+Enter and it works again.

 

So cURL has to target a specific window, input the 10 digit code+Enter. It cannot do that, as far as I can see.

 

I appreciate all your help so far, but my initial question still stands: Can keystrokes be simulated from php script ?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.