[ Team LiB ] Previous Section Next Section


In this hour, you learned how to communicate with the shell and through it with external applications. PHP is a powerful language, but it sometimes is faster to call on an application than it is to create similar functionality yourself.

You learned how to pipe data to and from a command using the popen() function. This approach is useful for applications that accept data on standard input and when you want to parse data as it is sent to you by an application.

You learned how to use exec(), system(), and the backtick operator to pass commands to the shell and to acquire user input. You learned about the dangers of passing user input to the shell and examined the escapeshellcmd() function, which will afford you some protection from malicious input. You learned how to use the passthru() function to accept binary data resulting from a shell command. Finally, you learned how to emulate server-side includes with the virtual() function.

In the next hour, we will examine PHP's support for XML. In addition to the stable PHP parser functions, we will explore some functions that were so new at the time of writing that they were still under development!

    [ Team LiB ] Previous Section Next Section