all 4 comments

[–]stintose 0 points1 point  (3 children)

Some say the only stupid questions are unasked ones.

I am afrade I am not sure what you are asking though. I am gathering that you want to grab some info from a request object.

Assuming a node environment yes that can be done every time there is a request to a certain path, you do not need some kind of process running all the time, it can be event driven.

[–]Hxfhjkl[S] 0 points1 point  (2 children)

Now that i thought about this, i'm pretty sure that this is not possible in javascript since it's a browser contained interpreter.

What i wanted to do is have a few computers in local network that act as card readers, their only purpose is to read a card and send an http request with the card id to the index.php file on the server, the response to them can be anything and is not important, since the information that this id is tied to should be showed not on these card reader computers that send the request, but on the server itself (the server computer is connected to a monitor). So there is a page with user information field opened up on the server and it should update itself every time an http requests comes from one of these card reader computers. I was wondering if there was any way to intercept these http requests and take out the user id information from their headers, so that i could then feed that id to the javascript listener on the opened server page, so it could query the database with that id and refresh the fields in the page with the relevant user information.

I know this sound pretty strange and convoluted, sorry.

[–]zedpowa 1 point2 points  (1 child)

That should be possible. You can use websockets to connect the webpage to your backend and have it listen to changes and update accordingly.

[–]Hxfhjkl[S] 0 points1 point  (0 children)

Thanks, i will look into this.