W3Schools.com

PHP popen() Function


PHP Filesystem Reference Complete PHP Filesystem Reference

Definition and Usage

The popen() function opens a pipe to the program specified in the command parameter.

This function returns FALSE if an error occurs.

Syntax

popen(command,mode)

Parameter Description
command Required. Specifies the command to execute
mode Required. Specifies the connection mode.

Possible values:

  • r: Read only
  • w: Write only (opens and clears existing file or creates a new file)


Example

<?php
$file = popen("/bin/ls","r");
//some code to be executed
pclose($file);
?>


PHP Filesystem Reference Complete PHP Filesystem Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE