HTA and PHP. A match made in heaven?

Jun
23
2004

Or maybe in hell. Who knows. I'm starting to feel like Dr. Frankenstein in my PHP experimentation. So, in another quest to do something just because I can, consequences be damned, I've taken the failure of the ActivePHP(see earlier this week) experiments and turned it into something that actually works. Fundamentally, the model that PHP, the browser and the web server operate on is passing HTTP messages back and forth. Once you remove the web server and substitute an HTA (HTML Application) for the regular browser page, all that needs to be stubbed in is a replacement for HTTP.

So, I did just that. I whipped up a series of Javascript functions that put the contents of a given form into a text file, call a PHP script on the commandline to process that text file and
then the PHP script sends back a message using another temporary text file. In short, round-trip communication. The current prototype uses calls to "php-cli scriptname.php" as its method for processing forms, but you could easily use Priadoblender-blended scripts instead to do the processing.

What you end up with is a simple way to build "stand-alone"
PHP applications without a web server and using HTML as your widget toolkit and GUI. In addition, the API for processing data is just like it is in a web app: simple name->value pairs. So, someone who is already familiar with building PHP web apps could quickly be up and running using this toolkit. Given the flexibility of this solution, it could become a viable alternative to PHP-GTK (at least for little scripts)

The thing still needs a name and some polish so name suggestions are welcome. I'll be putting it under an open source license on PHPGeek.com when it's done. Contact me if you want to play with a demo.

 

Comments on this post

Feedback is always welcome. Read some from other folks or leave your own below. Just keep things civil and remember that what you post lives on in public. Forever.

Thanks,
J

11 Responses to “HTA and PHP. A match made in heaven?”

  1. Mike Says:

    Hello, I'm very interested in having the ability to compile a php script into a stand alone windows application. As your article says, to contact you for a demo of your neato application. If you could send me a download URL that would be muchly appreciated. Thank You!

  2. George Says:

    Hello there, I would like to see the demo.
    am waiting for full version with impatience.

    many thanks if you send me a link too.

  3. Jimmy Says:

    Hi there, I was working on a similar project during the weekend, and every time I called the PHP script it opened the script in an editor. I will realy appreciate it if you could send me a URL to download the your demo. Many thanks!!

  4. mon-loi perez Says:

    hmm..sounds really nice…can i have a copy of the demo..

    -thanx..

  5. J Wynia Says:

    Unfortunately, I lost this code in a hard drive crash.

  6. Raf Says:

    Hey, I recently found about HTA files, that's excelent for simply GUI. If anyon's interested in reading php script output from hta application see my
    php-hta example: http://www.mahtar.net/files/hta-php-test.zip

  7. Luke Says:

    Nice procedure. Got it to work for a previously web-based application. One query though - any quick way to support php sessions? I'm trying to whip something together but just wanted to know if someone had already done it.

  8. J Wynia Says:

    I don't know of any reasonable way to automatically handle sessions. The Apache module version of PHP does a lot of work to just "magically" handle the sessions and that stuff isn't present in the CLI environment.

  9. Jarodium Says:

    Hello
    I have checked out the script where you guys have php working along side HTA's.
    But instead by creating a text file and make it read it through PHP would not be simpler to use the StdOut property of the Wscript.Exec ?
    I guess is trickier tough…

  10. Francois Says:

    Hi there !!

    The link to the file "hta-php-test.zip" above is broken … could you please repair it because i would like to have a look at it ??? thanks a lot and congratulations for your site !! bye

  11. ranger Says:

    I just discovered HTA (html applications). Currently looking into various ways to try and keep the hta files as open as possible (ie use of javaScript, php, etc instead of vbScript and other non-crossPlatform technologies).

    I'm really surprised that HTA isn't better known. It makes a great intro to programming via html, javaScript, client-side db connections, etc.. I'm looking for some OpenSource technology that's similar for Linux/*BSD - including Windows (essentially non-secure Kiosks - like any regular application with some additional presentation hooks to make the final product appear as a client-app).

    fyi… here's a downloadable demo I found using PHP on the back to process [FORM] info for anyone else interested in html as normal apps.

    http://www.phpgeek.com/pragmacms/index.php?layout=main&cslot_1=15

Leave Your Own Comment

By submitting a comment, you agree to license it under the terms of the Creative Commons Attribution license.

© 2003-2008 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.