RE: [PHP] Using fopen() to open a php file with variables.
| From: | John W. Holmes | Date: | Thu, 12 Dec 2002 01:52:30 +0000 |
| Subject: | RE: [PHP] Using fopen() to open a php file with variables. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127945@lists.php.net to get a copy of this message | ||
> Okay, I need to retrieve the output of a php file with variables being
> passed to it. Example:
>
> $calendar_file = "make_calendar.php3?month=$month&year=$year";
> $fp = $fp = fopen("$calendar_file", "r");
> while (!feof ($fp)) {
> $buffer = fgets($fp, 4096);
> $calendar_html .= $buffer;
> }
> fclose($fp);
>
> It gives me an error that the file doesn't exist, but it does. Any
> suggestions?
No, it doesn't exist. You have a file make_calendar.php3 on your system,
not what you've listed above. If you want to do it like that, fopen() it
with a full address:
fopen("http://yourdomain.com/make_calendar.php3?month=$month&year=$year"
);
Hopefully the email doesn't mangle that link...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/