News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Proc_Open Communicate with the Outside World
June 10, 2013 @ 09:43:01

On PHPMaster.com today there's a new tutorial from Timothy Boronczyk about using the proc_open function to kick off processes outside of PHP. It can be used to start up and manage (in a limited fashion) external process calls.

There are many ways we can interact with other applications from PHP and share data; there's web services, message queuing systems, sockets, temporary files, exec(), etc. Well, today I'd like to show you one approach in particular, proc_open(). The function spawns a new command but with open file pointers which can be used to send and receive data to achieve interprocess communication (IPC).

He starts off explaining one of the fundamental concepts behind working with processes - pipes, both anonymous and named. He then moves on to the use of proc_open and the three attributes it takes - command, pipes and references for output. He includes a more practical example showing it in use - a script that converts text with wiki markup into HTML output (via this tool).

0 comments voice your opinion now!
procopen tutorial processes command pipes

Link: http://phpmaster.com/proc-open-communicate-with-the-outside-world

RooJs.com:
How to spam in PHP..
April 11, 2011 @ 10:20:41

On RooJs.com there's a recent post from Alan Knowles looking at how to spam in PHP. No, nothing malicious - it's more about scalability in sending emails from PHP applications.

The reason this has been relivant in the last two weeks is two fold, first off, my slow and sometimes painfull Pman.Core and Pman.Base). It seemed like an ideal time to write some generic code that can solve both issues.

He mentions the usual method of generating numerous emails and sending them to a remote SMTP server, but points out that there's a better way. You can take advantage of queuing and batch sending techniques and, the way he decided to do it for mtrack, using queue tables and a backend runner (a cron job) that uses proc_open to send out multiple emails at once. You can see the code for it here.

0 comments voice your opinion now!
spam email send smtp process procopen mtrack


Matthew Turland's Blog:
CDC Update (or an Unusual Parse Error)
April 09, 2009 @ 09:32:46

Matthew Turland came across an interesting bug when working with the Cares Document Checker he's developing related to linting (running a syntax check) on a given PHP file.

While doing a lint check on a code block, a parse error was occurring on a line that contained a comment in the original source file. [...] Presumably what was happening was, even though the var_dump() call showed that actual newlines were being interpreted correctly, the r was also being interpreted rather than taken literally. This caused the comma following it to generate the error I was receiving.

An alternative to the method he was using, shell_exec, is proc_open, a function that opens a resource to handle a command execution and allows for more than just the "point and shoot" execution that things like shell_exec, or system.

0 comments voice your opinion now!
parse error vardump comment shellexec system exec procopen



Community Events





Don't see your event here?
Let us know!


framework podcast install package language introduction tips series opinion deployment api update zendserver community release list interview laravel symfony library

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework