Re: Redirect output of include() for mailing

From: Date: Tue, 22 Jul 2003 17:43:07 +0000
Subject: Re: Redirect output of include() for mailing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156285@lists.php.net to get a copy of this message
Hello, This is a reply to an e-mail that you wrote on Tue, 22 Jul 2003 at 18:37, lines prefixed by '>' were originally written by you. > But how can I instead capture the output of the include to variable > and mail > it, something like > $msg = include('myscript.php?foo=bar") Use output buffering... ob_start() // see http://uk2.php.net/ob_start include("youfile.php"); $mailthis = ob_get_contents() // see http://uk2.php.net/manual/en/function.ob-get-contents.php ob_end_clean() // see http://uk2.php.net/manual/en/function.ob-end-clean.php HTH David -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP)

« previous php.general (#156285) next »