0

I am working on a PHP project that makes use of MLB's Gameday data. There appears to be a pretty solid Ruby library for working with data. I don't particularly want to rewrite the entire library in PHP, so I was wondering if anyone had any suggestions for a good way to interact with the Ruby scripts from my PHP application.

I'm starting to think that I'll need to write some sort of command line Ruby script that'll interact with the Ruby classes and output the data in a format usable by PHP (JSON, XML).

Are there any better ways to do accomplish this?

1
  • Thanks for the responses. I don't need all of the data that the Ruby API provides, so I decided to just write a PHP class to get the data that I will be using. Commented Mar 12, 2011 at 18:07

2 Answers 2

1

Another option is to use Gearman, written by the the same team that brought us memcached. It has PHP and Ruby bindings.

You'd create a daemon in Ruby that exposes functions to Gearman, then have your PHP code call those functions through Gearman. No Apache needed.

(Boy, I'm on a Gearman plugging streak. I wish I was getting paid for it!)

Sign up to request clarification or add additional context in comments.

1 Comment

Looks like a great tool. I'll probably end up using that for something down the road.
1

Rather then a command line interface, I'd suggest outputting data in JSON format and requesting that data via PHP & CURL.

If you needed to you could even write a REST interface for it pretty easily.

2 Comments

Wouldn't using CURL cause more overhead since Apache (or whatever web server) would have to serve the file?
Yes, but Apache (or whatever web server) have been optimized to do just that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.