Archive for the ‘PHP’ Category

Trace statements for PHP

Wednesday, March 11th, 2009

If you’re a Flash developer then you probably use trace() as an essential part of your development routine. Maybe you even wrote a custom logger application to get a peak into what’s happening with your Flash application. Point is that you like to see what’s going on behind the scenes.

Now you’ve moved on to the big leagues and started connecting Flash to PHP to add server-side functionality to your application, but how do you see what’s happening with your PHP code? PHP has a little know feature called error_log() that lets you output messages to your web server’s log file. By tailing your log files while running your application you essentially get trace statements from your PHP code! You can do this by opening your terminal if on a Mac or use something like cygwin on Windows, change directories to where the log files are and run the tail command with the follow flag.

Welcome to Darwin!
colossus:~ chris$ cd /var/log/httpd/
colossus:/var/log/httpd chris$ tail -f error_log
[Tue Jun  5 22:31:11 2007] [error] This is my trace statement from PHP!

Enjoy and happy PHP testing!

cURL – PHP’s little known buddy

Sunday, September 7th, 2008

cURL my be the coolest library available for PHP next to GD Library. Basically it allows you to execute a variety of client-server operations across the web programmatically, which opens up a whole world of possibilities for PHP applications. When a site doesn’t have an API, you can use cURL to log in or even make your own web crawler.

It’s an extremely versatile tool with a laundry list of features, not to mention it can also be used on the command line! I highly recommend checking it out, especially since it’s supposedly possible to integrate Adobe AIR apps with command line functionality. I found lots of people talking, few example, nothing concrete. If you know anything about using the command line from within AIR, please post a comment.

Get more info on cURL.

Remoting with Flex and WebOrb

Wednesday, August 20th, 2008

Remoting is one of the coolest ways to get data from your server-side services or destinations as they are know in ActionScript. We recently used WebOrb on a project and it was was unbelievably easy to set-up and works great. In comparison to AMFPHP , it was considerably easier to set-up, required no modification to my PHP classes and has a very similar set-up to that of FDS. I found the documentation somewhat light, although the Quick Start guide was very helpful.

So, what really made me choose WebOrb over AMFPHP? There are several reasons, but mainly the fact that it supports multiple programming languages and is upgradeable to include FDS comparable features for languages other than JAVA. Also they offer professional paid support, which can make a huge difference when deploying a large application for an important client and offer security features and a handy management console with the professional version. The final factor was that I found some good recommendations for its usage on sites that I respect and trust.

[update 10/14/08]
Adobe has opened up Flash Remoting (aka BlaszeDS) and the AMF protocol. Thanks Adobe!