Jump to content

Recommended Posts

Posted (edited)

Hi folks!

I bring this little executable file and an AutoIt wrapper for it to generate documents (bills and incomes) by sending variables (strings, numbers or even arrays) to a PHP script you wrote.

This is the syntax:

themecli.exe <input> <output> <vars>

  • input: The input PHP file (the extension does not need to be .php, it can be anything, like .html, .txt, .bin, .wtf...), relative to @ScriptDir
  • output: The output HTML file to save, relative to @ScriptDir
  • vars: A base64-encoded JSON with all the variables (hard? Don't worry! See below:)

Looks confusing? Well, don't worry. That's why we have a wrapper!

Example, if we have this file "page.php":

Hello, <?=$user?>! How are you?

And do this with AutoIt (using my JSONgen UDF [ http://www.autoitscript.com/forum/index.php?showtopic=173797 ] which is already included in AutoPHP):

#include 'inc\autophp.au3'

$ojson = New_JSON()
JSON_AddElement($ojson, 'user', 'John Doe')
$json = JSON_GetJSON($ojson)

AutoPHP('page.php', 'hello.txt', $json)

Note that you don't need to base64-encode it. After running it, we will see a file named "hello.txt", and the content is:

Hello, John Doe! How are you?

On the PHP file you can also use loops and everything else supported in PHP4 (since it uses Bambalam PHP Compiler, it does not support PHP5 yet).

On the zip file there is an example of how to use it with loops.

License: same Bambalam PHP Compiler license: :P

  Quote

[...]

let's just say that it's free, and I don't want to get sued. Ok? 

 

Tip: If you use wkhtmltox, you'll be able to convert the generated HTML file into PDF with just a few lines! See here: https://www.autoitscript.com/forum/topic/173611-wkhtmltox-autoit-objectclass-to-convert-html-filespages-into-pdf-and-images/ 

 

Download:

  •  AutoPHP.zip full script, dependencies and examples (everything you need to start using AutoPHP)
  •  phpthemecli-src.zip Themecli binary and source (Themecli is the tool that AutoPHP uses to run PHP code - since it's already included on AutoPHP UDF, you don't need to download it, unless you want to use it with another programming language)
Edited by Jefrey

My stuff

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...