4 ms·
If the script is local to the web server then it can be run via cron to produce html/js/css files. If the script is external then it must be capable of making
by Donckele 4y ago
If the script is local to the web server then it can be run via cron to produce html/js/css files.
If the script is external then it must be capable of making a http request to the server where a script does something similar to the scenario above.
- TaylorAlexander 4y agoYeah. I have a couple servers I could maybe run something on. I guess I don’t really know how to serve a link where I could make an HTTP request. I run servers with discourse and other applications but I never manually serve something. I suppose this is simple enough and I should look that up. What is it called on the server side when you make a URL available for receiving HTTP requests? I realize I’m not sure what to research exactly. EDIT: wait a minute, actually I’ve used flask before with python. I guess I just need to figure out how to run flask on my web server, maybe on a sub domain, without interfering with the discourse instance that’s already there. Hmmm.
- Donckele 4y agoYep, a simple flask app is an option. Easy to deploy and have a simple endpoint hook that reads the input parameters and then does your magic of writing out some static files and/or if you feel adventurous write out json files that can be read via javascript!
- jcynix 4y agoKnowledge of plain old CGI on a web server seems lost due to fancy frameworks? And even without the CGI-Interface, you can make it work if you have a script monitoring your web server's logs: I sometimes transfer data with curl via a url which does not exist, but where a script running on the server watches the server's error log and extracts data from those entries. For example: access (via curl or perl' GET, or whatever) these urls http://my-server/data0815/up+2 http://my-server/data0815/up+2 http://my-server/data0815/down-3 http://my-server/data0815/down-3 The script watches for these entries and acts upon the stuff following the data0815 part. It's a fast hack, which can be augmented and expanded in various ways, all without frameworks.
- TaylorAlexander 4y ago> Knowledge of plain old CGI on a web server seems lost due to fancy frameworks? eh I just never learned it. I'm a robotics engineer and I tend to write programs in Python (or less commonly now, C++) to run in a loop and deal with local hardware. The way that web servers operate in a stateless multithreaded way involves some peculiarities that I always find a little tricky. > I sometimes transfer data with curl via a url which does not exist, but where a script running on the server watches the server's error log and extracts data from those entries. Hey that's a nice trick! I already have a server running discourse. Maybe I can sneak something in there. Though it looks like someone's suggestion of https://healthchecks.io/ https://healthchecks.io/ might do what I need.
- lioeters 4y ago> What is it called on the server side when you make a URL available for receiving HTTP requests? This fits the definition of API (application programming interface). For a single API endpoint to post data, I would personally write a little Node.js script using built-in HTTP module or Express. For Python, maybe something like this: https://pythonbasics.org/flask-rest-api/ https://pythonbasics.org/flask-rest-api/