• 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ãã Mo> my win7_x86 system.ãã Mo> I tried system.popen("c:\php\php.exe c:\sbbs\myscript.php " + someargs);ã Mo> 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ãã > Mo> 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 wkitty42@VERT/SESTAR to Mortifis on Sun Feb 10 10:56:10 2019
    Re: run external php scriptã By: Mortifis to All on Sat Feb 09 2019 15:57:26ãã > So, my question is, how do I trap the result under windows, itã > is handled automagically under Linuxããwe just went through this with tickit... we were trying to determine whyãaddfiles was not working right for someone when tickit ran as an event but itã(addfiles) did run properly when they manually ran tickit...ãã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...ããã)/\(aldoãã---ã þ Synchronet þ SouthEast Star Mail HUB - SESTARã
  • From Mortifis@VERT/ALLEYCAT to Digital Man on Sun Feb 10 12:26:18 2019
    Re: run external php scriptã > By: Mortifis to All on Sat Feb 09 2019 03:57 pmãã ã > 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).ãã ãNo wonder I dislike windows LOLããIs there an equivelent to file_get_content('http://blah_blah.blah');ãI was poking around some sources and found http_request.header but it didn'tãwork.ããI am just trying to include a little url data in index.ssjsããie: template.myvar = whatever_grabs_the_url_contents('http://the.url/' +ãany_args);ããso I can simply use @@myvar@@ in any web docs. ( I have done this on Linuxãwithout issue using system.popenãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From Mortifis@VERT/ALLEYCAT to Digital Man on Sun Feb 10 12:29:40 2019
    Re: run external php scriptã > By: Mortifis to All on Sat Feb 09 2019 03:57 pmãã ã > 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).ãã ãNo wonder I dislike windows LOLããIs there an equivalent to file_get_content('http://blah_blah.blah');ãI was poking around some sources and found http_request.header but it didn'tãwork.ããI am just trying to include a little url data in index.ssjsããie: template.myvar = whatever_grabs_the_url_contents('http://the.url/' +ãany_args);ããso I can simply use @@myvar@@ in any web docs. ( I have done this on Linuxãwithout issue using system.popenãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From echicken@VERT/ECBBS to Mortifis on Sun Feb 10 12:07:00 2019
    Re: Re: run external php scriptã By: Mortifis to Digital Man on Sun Feb 10 2019 12:29:40ãã Mo> Is there an equivalent to file_get_content('http://blah_blah.blah');ããrequire('http.js', 'HTTPRequest');ãconst response = (new HTTPRequest()).Get('http://blah_blah.blah');ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-425-5435ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
  • From Mortifis@VERT/ALLEYCAT to echicken on Sun Feb 10 16:37:16 2019
    Re: Re: run external php scriptã > By: Mortifis to Digital Man on Sun Feb 10 2019 12:29:40ãã > Mo> Is there an equivalent to file_get_content('http://blah_blah.blah');ãã > require('http.js', 'HTTPRequest');ã > const response = (new HTTPRequest()).Get('http://blah_blah.blah');ããThank you, I am getting closer, just gotta scrape some css stuffs in theãresponse.ããBTW where do I find your openweathermap.js? I looked on github under web4butãseem to have lost my glasses :-oãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From echicken@VERT/ECBBS to Mortifis on Sun Feb 10 16:15:54 2019
    Re: Re: run external php scriptã By: Mortifis to echicken on Sun Feb 10 2019 16:37:16ãã Mo> BTW where do I find your openweathermap.js? I looked on github underã Mo> web4but seem to have lost my glasses :-oããIt's a generic library and not part of the web interface. I put it in theãSynchronet CVS under exec/load/. Note that the script doesn't do anything onãits own to display information to a BBS user; it's a library for scripts thatãwant to interact with the OWM API.ããI did create a sidebar module for the web interface that uses this library;ãit's under web/sidebar/.extras/ in the github repo.ããOpenWeatherMap use requires an API key, so you'll have to go to their site andãsign up for one. Add a section to ctrl/modopts.ini like this:ãã[openweathermap]ãapi_key=your_api_key_hereããThe library is designed to cache data and respect the rate limits imposed onãOWM free-tier accounts by default.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.com - 416-425-5435ã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
  • From Mortifis@VERT/ALLEYCAT to wkitty42 on Sun Feb 10 17:12:24 2019
    Re: run external php scriptã > By: Mortifis to All on Sat Feb 09 2019 15:57:26ãã > > So, my question is, how do I trap the result under windows, itã > > is handled automagically under Linuxãã > we just went through this with tickit... we were trying to determine whyã > addfiles was not working right for someone when tickit ran as an event butã > it (addfiles) did run properly when they manually ran tickit...ãã > 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 ... I onlyãbothered with all this cuz I broke a G string on my acoustic and got bored LOLãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From Mortifis@VERT/ALLEYCAT to echicken on Sun Feb 10 19:16:18 2019
    Re: Re: run external php scriptã > By: Mortifis to echicken on Sun Feb 10 2019 16:37:16ãã > Mo> BTW where do I find your openweathermap.js? I looked on github underã > Mo> web4but seem to have lost my glasses :-oãã > It's a generic library and not part of the web interface. I put it in theã > Synchronet CVS under exec/load/. Note that the script doesn't do anythingã > on its own to display information to a BBS user; it's a library for scriptsã > that want to interact with the OWM API.ããwhich is what I want to play with :-)ãã > I did create a sidebar module for the web interface that uses this library;ã > it's under web/sidebar/.extras/ in the github repo.ããI was looking in web/sidebar/.extras/openwethermap.ssjs and saw the referenceãto openweathermap.js but couldn't find it either on my system or in github.ãI'll grab it from cvs.synchro.net, thanksããã > OpenWeatherMap use requires an API key, so you'll have to go to their siteã > and sign up for one. Add a section to ctrl/modopts.ini like this:ããããI have had an openweathermap key for a couple years that I use with my phpãscripts, I still use Duece's old runemaster nightshade, but I will look intoãthe webv4, thanks :)ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • From Mortifis@VERT/ALLEYCAT to echicken on Sun Feb 10 19:22:23 2019
    Re: Re: run external php scriptã > By: Mortifis to echicken on Sun Feb 10 2019 16:37:16ãã > Mo> BTW where do I find your openweathermap.js? I looked on github underã > Mo> web4but seem to have lost my glasses :-oãã > It's a generic library and not part of the web interface. I put it in theã > Synchronet CVS under exec/load/. Note that the script doesn't do anythingã > on its own to display information to a BBS user; it's a library for scriptsã > that want to interact with the OWM API.ãã ãBTW I have been working on incorporating the wttr.in python scripts or curlãcallsãinto the web/nightshade templates. I have used both openweathermaps andãwttr.in for sometime on some of my other sites under LAMP using both <iframe>ãand file_get_contents, just playing around. I will look closely at the .js ...ãI appreciate the help, thanks.ãã---ã þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81ã
  • 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ã