Sinisterly
Edit python code using php - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: PHP (https://sinister.ly/Forum-PHP)
+--- Thread: Edit python code using php (/Thread-Edit-python-code-using-php)



Edit python code using php - yuyboy - 06-20-2014

Hi all,
I have my own chat bot &i give some services for people which i give them link for signup(Email,Bot Id, Bot Password..etc) then when i receive thier information i open my python bot on my vps & edit the config file then i put the information after that i run the bot for them.

After a long time i become tired from this and i need to make something new.
What i need to say:
Can i edit the the config file which is loaceted on root then & put the information then i run it using php code..?

So, like this i can run bot's for people easily..


Hope my thread id clear.

Thank you.


RE: Edit python code using php - Ex094 - 06-20-2014

What you can do is create a template, Then add all the necessary info in the particular places and then when it's complete store that with .py extension and have the script execute that file


RE: Edit python code using php - yuyboy - 06-20-2014

But how i can edit my .py file which is in my server(in the root) using php code?


RE: Edit python code using php - Ex094 - 06-20-2014

(06-20-2014, 05:18 PM)yuyboy Wrote: But how i can edit my .py file which is in my server(in the root) using php code?

I already gave the ans, What I am trying to say is that instead of saving that file already and editing it. Why not use a template code, put the appropriate items in place and then save it as .py and run it


RE: Edit python code using php - Anima Templi - 06-20-2014

Simply make a simple interface with a PHP backend to open/read/write to the config file. It's not that complicated.


RE: Edit python code using php - yuyboy - 06-20-2014

Thank you..
But i ask for help because i dont know alot about php.
Tht's why i reAsk again how i can edit the file using php.
I need to start make my projet but i dont know how.

Hmmm thank you again.


RE: Edit python code using php - Anima Templi - 06-20-2014

I would advice you to take a look at learning the basics of PHP before you even think about starting such a project. Then maybe take a look into these links:

http://www.tutorialspoint.com/php/php_files.htm
http://www.php.net//manual/en/function.file-put-contents.php


RE: Edit python code using php - levi01 - 06-20-2014

I think if you really have no PHP skills he could better start reading here: http://www.php.net/urlhowto.php

Without this knowledge don't try anything, and standard scrips for such particular jobs don't exist.

You have to create your own script with your own needs, with the info you gave nobody could help you.


RE: Edit python code using php - yuyboy - 06-21-2014

Thank you @anima templi & @levi01.
I will try my best..