The function open_proc waits until the external application has finished to obtain the result. For example; Linux command “top -b -n 5” will do 5 iterations before ending. That is when “proc_open” can see the result.

Example: Get temperature of a city

We can use the PHP “proc_open” function to interact with external applications that show the temperature of any city in the world.