Code:

generate page script:

$pge = create-page.php
$pd = $HTTP_GET_VARS['pd'];

# Set the files
$crtPge = "/". $pge ."?pd=". $pd; # the url of the dynamic page to write the
output page
$targetfilename = $SITE_ DOCUMENT_ROOT . $outPge; # the output page

# delete previous version of temp file if it exists
@unlink('temp.html');

# open the dynamic page into dynpage
$dynpage = fopen($crtPge, 'r');

# Check for errors
if (!$dynpage) {
 echo("<p>Unable to load " . $crtPge . ". Static page update aborted!</p>");
 exit();
}

# function read the data
$htmldata = fread($dynpage, 1024*1024);

# close the dynamic page
fclose($dynpage);

# connect to temp file ready to write
$tempfile = fopen('temp.html', 'w');

# Check for errors
if (!$tempfile) {
 echo("<p>Unable to open temporary file " . ('temp.html') . " for writing.
Static page update aborted!</p>");
 exit();
}

#write to temp file
fwrite($tempfile, $htmldata);

# close the temp file
fclose($tempfile);

etc...
================================
===============================
create-page.php:

<?
session_start();

$SITE_ DOCUMENT_ROOT = '/usr/local/htdocs/' . $HTTP_SESSION_VARS['site_Loc']
. '/';

The line above fails when being read by fread in the generate script code
above, but works when I browse to it.

Hope this makes more sense.

Zac


----- Original Message -----
From: "John Holmes" <[EMAIL PROTECTED]>
To: "'Zac Hillier'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, May 27, 2002 3:28 PM
Subject: RE: [PHP] fread and session vars


> Post some code. I don't understand completely what you're trying to do
> or how you're trying to do it.
>
> ---John Holmes...
>
> > -----Original Message-----
> > From: Zac Hillier [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, May 27, 2002 9:20 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] fread and session vars
> >
> > Hi all,
> >
> > I'm using the fread function to read one of my php scripts and then
> > produce a static page, within this script I'm using session variables.
> >
> > If I browse to the script normally then all appears to work correctly,
> > however when I use the fread function the session variables are not
> being
> > translated. I've tried adding & SID to the end of the URL but to no
> avail.
> > Can anyone suggest a course of action. I'm reluctant to produce GET
> > variables as there are many variables and this script will need to be
> used
> > by multiple domains.
> >
> > Thanks,
> >
> > Zac
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to