<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Running_a_Python_script_from_PHP</id>
	<title>Running a Python script from PHP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.planetoid.info/index.php?action=history&amp;feed=atom&amp;title=Running_a_Python_script_from_PHP"/>
	<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Running_a_Python_script_from_PHP&amp;action=history"/>
	<updated>2026-07-11T01:06:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Running_a_Python_script_from_PHP&amp;diff=22347&amp;oldid=prev</id>
		<title>Unknown user: /* Different approaches */</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Running_a_Python_script_from_PHP&amp;diff=22347&amp;oldid=prev"/>
		<updated>2021-06-20T13:57:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Different approaches&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 21:57, 20 June 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l7&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Execute the Python script from command line  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Execute the Python script from command line  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.exec.php exec()], [http://www.php.net/manual/en/function.system.php system()], [http://www.php.net/manual/en/function.shell-exec.php shell_exec()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/19735250/running-a-python-script-from-php Running a Python script from PHP - Stack Overflow]&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.exec.php exec()], [http://www.php.net/manual/en/function.system.php system()], [http://www.php.net/manual/en/function.shell-exec.php shell_exec()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/19735250/running-a-python-script-from-php Running a Python script from PHP - Stack Overflow]&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Ppass &lt;/del&gt;the parameter from command line or file&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Pass &lt;/ins&gt;the parameter from command line or file&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Possible issues: It the command line is too long, it will reach the [https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-experience/command-line-string-limitation Command prompt line string limitation]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string windows - Maximum Length of Command Line String - Stack Overflow]&amp;lt;/ref&amp;gt;. &amp;amp; To avoid [https://owasp.org/www-community/attacks/Command_Injection Command Injection] using [https://www.php.net/manual/en/function.escapeshellcmd.php PHP: escapeshellcmd()].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Possible issues: It the command line is too long, it will reach the [https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-experience/command-line-string-limitation Command prompt line string limitation]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string windows - Maximum Length of Command Line String - Stack Overflow]&amp;lt;/ref&amp;gt;. &amp;amp; To avoid [https://owasp.org/www-community/attacks/Command_Injection Command Injection] using [https://www.php.net/manual/en/function.escapeshellcmd.php PHP: escapeshellcmd()].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* HTTP GET &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;protocol&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* HTTP GET &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;request&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()] or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()] or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: GET parameter&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: GET parameter&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Possible issues: Maximum length of HTTP GET request&amp;lt;ref&amp;gt;[https://helpx.adobe.com/mt/experience-manager/scene7/kb/base/is_protocol-_-forming_is/url-character-limit-get-requests.html URL character limit for Get requests | Scene7]&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Possible issues: Maximum length of HTTP GET request&amp;lt;ref&amp;gt;[https://helpx.adobe.com/mt/experience-manager/scene7/kb/base/is_protocol-_-forming_is/url-character-limit-get-requests.html URL character limit for Get requests | Scene7]&amp;lt;/ref&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* HTTP POST &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;protocol&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* HTTP POST &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;request&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents http - How to post data in PHP using file_get_contents? - Stack Overflow]&amp;lt;/ref&amp;gt; or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents http - How to post data in PHP using file_get_contents? - Stack Overflow]&amp;lt;/ref&amp;gt; or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: POST form data or payload&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Pass parameter: POST form data or payload&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
	<entry>
		<id>https://wiki.planetoid.info/index.php?title=Running_a_Python_script_from_PHP&amp;diff=22346&amp;oldid=prev</id>
		<title>Unknown user: Created page with &quot;Running a Python script from PHP  {{Draft}}  == Different approaches ==  * Execute the Python script from command line  ** Method: Using PHP function such as [https://www.php....&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.planetoid.info/index.php?title=Running_a_Python_script_from_PHP&amp;diff=22346&amp;oldid=prev"/>
		<updated>2021-06-20T13:54:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Running a Python script from PHP  {{Draft}}  == Different approaches ==  * Execute the Python script from command line  ** Method: Using PHP function such as [https://www.php....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Running a Python script from PHP&lt;br /&gt;
&lt;br /&gt;
{{Draft}}&lt;br /&gt;
&lt;br /&gt;
== Different approaches ==&lt;br /&gt;
&lt;br /&gt;
* Execute the Python script from command line &lt;br /&gt;
** Method: Using PHP function such as [https://www.php.net/manual/en/function.exec.php exec()], [http://www.php.net/manual/en/function.system.php system()], [http://www.php.net/manual/en/function.shell-exec.php shell_exec()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/19735250/running-a-python-script-from-php Running a Python script from PHP - Stack Overflow]&amp;lt;/ref&amp;gt;&lt;br /&gt;
** Pass parameter: Ppass the parameter from command line or file&lt;br /&gt;
** Possible issues: It the command line is too long, it will reach the [https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-experience/command-line-string-limitation Command prompt line string limitation]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string windows - Maximum Length of Command Line String - Stack Overflow]&amp;lt;/ref&amp;gt;. &amp;amp; To avoid [https://owasp.org/www-community/attacks/Command_Injection Command Injection] using [https://www.php.net/manual/en/function.escapeshellcmd.php PHP: escapeshellcmd()].&lt;br /&gt;
&lt;br /&gt;
* HTTP GET protocol&lt;br /&gt;
** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()] or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;br /&gt;
** Pass parameter: GET parameter&lt;br /&gt;
** Possible issues: Maximum length of HTTP GET request&amp;lt;ref&amp;gt;[https://helpx.adobe.com/mt/experience-manager/scene7/kb/base/is_protocol-_-forming_is/url-character-limit-get-requests.html URL character limit for Get requests | Scene7]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HTTP POST protocol&lt;br /&gt;
** Method: Using PHP function such as [https://www.php.net/manual/en/function.file-get-contents.php file_get_contents()]&amp;lt;ref&amp;gt;[https://stackoverflow.com/questions/2445276/how-to-post-data-in-php-using-file-get-contents http - How to post data in PHP using file_get_contents? - Stack Overflow]&amp;lt;/ref&amp;gt; or PHP cUrl library [https://www.php.net/manual/en/book.curl.php Client URL Library]&lt;br /&gt;
** Pass parameter: POST form data or payload&lt;br /&gt;
** Possible issues:&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]] [[Category:PHP]] [[Category:Python]]&lt;/div&gt;</summary>
		<author><name>Unknown user</name></author>
	</entry>
</feed>