[Glitch] PHP? $_GET


#1

Okay so, i’m working on a Whitelisting System, just got a little problem, i only know a bit JavaScript so i dont really know if its possible with HTML, css or JavaScript but like… In php you have $_GET thing and then you would be able to have like… site.com/?thing=ajnweia
I would like to make something like that and that it saves the ajnweia but i wouldn’t know how, since as far as i know Glitch doesn’t support Php


#2

It is possible to run PHP on Glitch if you remix one of the PHP starter projects: PHP work on Glitch?


#3

Yea, but i want to connect my website to my node app… Thats the thing. But i need Php to use $_GET stuff


#4

Hey @Jethrootje, I’m not quite sure what you’re asking. Are you looking for a way to do what you would use $_GET for in PHP, but in node? Or are you asking about how to run a PHP application on Glitch? Or something else enitrely?


#5

Okay so, the first option you gave is an option i would like to have, or… I want it so i can use Php with the node application i’m using.

Example:
Discord Bot (Connected with) Website using JavaScript / Php / Html / Css
I’m using Quick.db for databases on the discord bot, but i would like to use those in the Site too, and i know thats possible with JavaScript, but what i dont know if it is possible to use anything equal to $_GET cause people need to use the /?key=StoredDatabaseKey


#6

In Node there are any number of different frameworks you could use to handle the website portion of your bot. Most of our starter projects start you out using Express, which is a well-known and relatively straightforward option. If you stick with that then you’ll create listeners for various routes in your site, so if you wanted to grab the key passed to your project’s homepage you might do something like this:

app.get("/", function( request, response ) {
  let key = request.query.key;
  // do stuff with key
});

You can read more about the request object in Express at https://expressjs.com/en/4x/api.html#req.

As far as running Node (for your bot) and PHP (for your site) side-by-side; that probably won’t work in Glitch. One option could be to add an API (application programming interface) in your bot project with node and then have a separate PHP-based project serving the website that gets its data from the API.


#9

Thanks for the help! Have a great day further.