• run external php script

    From Mortifis@VERT/ALLEYCAT to All on Sat Feb 9 15:57:26 2019
    I am trying to get a php script to run externally from an sbbs.ssjs script, I have this working on my Linux system but am having problems on my win7_x86 system.

    I tried system.popen("c:\php\php.exe c:\sbbs\myscript.php " + someargs);
    which returns nothing

    so I tried system.exec("c:\php\php.exe c:\sbbs\myscript.php " + someargs); which returns 1

    So, my question is, how do I trap the result under windows, it is handled automagically under Linux

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Sat Feb 9 16:23:34 2019
    Re: run external php script
    By: Mortifis to All on Sat Feb 09 2019 15:57:26

    my win7_x86 system.

    I tried system.popen("c:\php\php.exe c:\sbbs\myscript.php " + someargs); which returns nothing

    Per the docs, system.popen does not work on Windows:

    http://synchro.net/docs/jsobjs.html#system_methods

    There's probably a better way, but this might work:

    system.exec('c:\php\php.exe c:\sbbs\myscript.php ' + someargs + ' >c:\poop'); const f = new File('/poop');
    f.open('r');
    const poop = f.readAll();
    f.close();

    Now variable 'poop' will be an array of lines of output from your command.

    If I were doing a lot of this, I'd probably make a function that:

    - Takes the command-line to execute as an argument
    - Generates a random tempfile name
    - Runs the command and tacks on the redirect to the temp file
    - Reads the temp file contents
    - Deletes the temp file
    - Returns the temp file contents

    And then I'd probably still feel a bit gross.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com - 416-425-5435
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/ALLEYCAT to echicken on Sat Feb 9 18:02:49 2019
    Re: run external php script
    By: Mortifis to All on Sat Feb 09 2019 15:57:26

    my win7_x86 system.


    If I were doing a lot of this, I'd probably make a function that:

    - Takes the command-line to execute as an argument
    - Generates a random tempfile name
    - Runs the command and tacks on the redirect to the temp file
    - Reads the temp file contents
    - Deletes the temp file
    - Returns the temp file contents

    And then I'd probably still feel a bit gross.

    perhaps a shower afterward would help :-)

    Thanks for the info, now I gotta p, open a beer

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Sat Feb 9 16:17:51 2019
    Re: run external php script
    By: Mortifis to All on Sat Feb 09 2019 03:57 pm

    I am trying to get a php script to run externally from an sbbs.ssjs script, I have this working on my Linux system but am having problems on my win7_x86 system.

    I tried system.popen("c:\php\php.exe c:\sbbs\myscript.php " + someargs); which returns nothing

    system.popen() only works on *nix-like OSes (not Windows).

    so I tried system.exec("c:\php\php.exe c:\sbbs\myscript.php " + someargs); which returns 1

    Is that literally what you tried, or did you double-up those backslashes, as would be necessary in a JavaScript string?

    So, my question is, how do I trap the result under windows, it is handled automagically under Linux

    system.exec() will just run the command. If you want the output of the command, you'll need to redirect the output to a file and read that file (on Windows).

    digital man

    Synchronet "Real Fact" #88:
    SBBSecho v3.00 was first committed to cvs.synchro.net on Apr-11-2016.
    Norco, CA WX: 55.3øF, 60.0% humidity, 2 mph NW wind, 0.09 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rampage@VERT/SESTAR to Mortifis on Thu Feb 14 13:17:04 2019
    Re: Re: run external php script
    By: Mortifis to wkitty42 on Sun Feb 10 2019 17:12:24

    look at the tickit sources in the addfiles section and you'll
    see what i came up with that worked great and was left in
    tickit if anyone needed the facility later for
    troubleshooting...

    I did, thank you, knew how to redirect to files and read them,
    seems a long way around that mr gates imposed upon us :-Þ
    hopefully some future verion of winbloz has a
    comparable > /dev/null 2>&1 function or whatever ...

    well, it does but it is slightly different ;)

    I only bothered with all this cuz I broke a G string on my
    acoustic and got bored LOL

    i think i'd rather play with the G string as long as the female that owns it is close by and willing to play a "round or two" O:) -=B-)


    )\/(ark

    ---
    þ Synchronet þ SouthEast Star Mail HUB - SESTAR
  • From Mortifis@VERT/ALLEYCAT to Rampage on Thu Feb 14 15:13:34 2019

    I only bothered with all this cuz I broke a G string on my
    acoustic and got bored LOL

    i think i'd rather play with the G string as long as the female that owns it is close by and willing to play a "round or two" O:) -=B-)


    that might work for you but they know what I look like so they'd likely play the E eeeeee...... & leave me B eeeeee ... strings and run away :-P



    2 wrongs don't make a right, but 3 left turns will get you back on the freeway!

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81