run_as_php

run_as_php($content,$path,$show=false,$params=""); - execute a php file on the computer where the human emulator is running.

The function accepts parameters as input:

  • $content – contents of the bat file
  • $path – path to the file
  • $show – whether to show the window with the result of execution
  • $params – parameters for passing a php file via argv[]

    After testing, the function returns the result of its work to the script :
  • true – completed successfully
  • false – failed

    PHP example: app->".basename(__FILE__)."
    "; //PHP $php = " 1) echo \u0022 arg1: $"." argv [1] n "; n"; $php = $php."if(count($"."argv)> 2) echo \u0022 arg2: $"." argv [2] n "; n"; $php = $php."echo('php is runnig'); n"; $php = $php."sleep(15); n"; $php = $php."?> n"; //1 echo "1.Run PHP in hidden state without parameters:"; echo $app->run_as_php($php, "test \ 1.php", false, "")."
    "; //2 echo "2.Run PHP visible without parameters:"; echo $app->run_as_php($php, "test \ 1.php", true, "")."
    "; //3 echo "3.Run PHP visible with parameters:"; echo $app->run_as_php($php, "test \ 1.php", true, "1 2")."
    "; //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7011" from xweb_human_emulator import * # Start echo("
    app.xxxxxxxxx
    ") # PHP php = " 1) echo('arg1: argv [1] ') " php = php + "if count(argv)> 2) echo(\ u0022arg2: argv [2] \ u0022) " php = php + "echo('php is runnig')) " php = php + "sleep(15)) " php = php + " " # 1 echo("1.Run PHP in hidden state without parameters:") echo(app.run_as_php(php, "test \ 1.php", false, ""), "
    ") # 2 echo("2.Run PHP visible without parameters:") echo(app.run_as_php(php, "test \ 1.php", true, ""), "
    ") # 3 echo("3.Run PHP visible with parameters:") echo(app.run_as_php(php, "test \ 1.php", true, "1 2"), "
    ") # end echo("

    ") # Quit app.quit()
    C# example: #region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7010"; InitXHE(); //Start echo("
    app.run_as_php
    "); //pkhp string php = " n"; //1 step echo("1.Start in hidden state with parameters:"); echo(app.run_as_php(php, "test \ 1.php", false, "2 3") + "
    "); //step 2 echo("2.Start in visible state with parameters:"); echo(app.run_as_php(php, "test \ 1.php", true, "2 5") + "
    "); //step 3 echo("3.Start in visible state with parameters:"); echo(app.run_as_php(php, "test \ 1.php", true, "3 4") + "
    "); //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7010"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    app.run_as_php
    "); //pkhp php = " n"; php + = "echo \u0022 arg1: $argv [1] "; n"; php + = "echo \u0022 arg2: $argv [2] "; n"; php + = "sleep(5); n"; php + = " n"; //1 step echo("1.Start in hidden state without parameters:"); echo(app.run_as_php(php, "test \ 1.php", false) + "
    "); //step 2 echo("2.Start in visible state with no parameters:"); echo(app.run_as_php(php, "test \ 1.php", true) + "
    "); //step 3 echo("3.Start in visible state with parameters:"); echo(app.run_as_php(php, "test \ 1.php", true, "1 2") + "
    "); //end echo("

    "); //Quit app.quit();