I am wanting to call a RAILS script within my php code base to avoid having to duplicate complicated business logic. I see that in PHP I can use passthru() but I'm not sure that is the best bet when returning more than a string back to the PHP function. I need to return back a hash/object of key/value pairs.
I'll be using script/runner on the RAILS side so that I don't have to change anything in the RAILS code. I was hoping there would be a simpler way to do this but I'm finding very little documentation on the webs that relates to this. Thanks in advanced.
You can make your Rails script output a CSV data and then use PHP's fgetcsv to parse it into array. Of course, you'll have to modify your Rails code to output CSV, but it doesn't sound like a big change - just a couple of lines to convert your data into CSV. FasterCSV gem could help with that.