Re: Including a URL for mailing..

From: Date: Wed, 11 Apr 2001 22:19:14 +0000
Subject: Re: Including a URL for mailing..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48212@lists.php.net to get a copy of this message
> What I'm trying to do is specify a URL in a form, and then take that URL, > put its contents into a variable, and mail it out in an e-mail message with > the body of the message being that URL. I haven't gotten anywhere so far, > just getting blank messages for the body.. can anyone point me in the > right direction on saving the contents of a page to a variable? I've ran > across a few examples, but nothing has worked for me yet. :( > > Thanks, > Chad > try using output buffering. In a php script put the following: ob_start(); //everything following will be stored for output. include 'your_page.php'; $body=ob_get_contents(); //store everything in output in $body variable Then mail as usual. Your page will be the $body variable. If you want to display the page as well use ob_end_flush(). If you just want to mail the page use ob_end_clean() to clear the output buffering and continue scripting for normal display. check out http://www.php.net/manual/en/ref.outcontrol.php for more information on output buffering. If you are still stuck email me off list and I will send you a sample of a file that does the same thing for me. Brett

« previous php.general (#48212) next »