Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.58/5 (5 votes)
Hello everyone, I need to create a web page that can take the input from the user and compile it according to the selected programming language.

Please, could you help me ?

What I have tried:

I saw many sites providing services to compiling any programming language on the web page such as onecompiler, onlinegdb.

How can I do that?

Thank you
Posted
Updated 2-Nov-22 0:07am
v2

To do that you have to own VPS to run shell commands the following example shows you how to run a python file in shell. That means you will receive the input then create a virtual file with python name and then execute it by using the following command.
Shell
python3 file_name.py

Once you finished the compilation, you have to delete the virtual file to save the memory and clean caches.
That’s the idea.
There are many sites such as (W3schools, Programiz, Sitepoint , CodedTag) using an online compiler like online python compiler, node.js compiler, etc.
I think all these sites are using the same idea.
 
Share this answer
 
v4
I guess, they are using Application Programming Interfaces(APIs). So, they are sending the user coding into URL of API to compile it.

If you have any question let me know
Online Python Compiler
 
Share this answer
 
v4
Comments
Moneer Fahmy 2-Nov-22 6:28am    
The solution 1 explaining how to create API Also ! so my answer is correct

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900