NYCPHP Meetup

NYPHP.org

[nycphp-talk] XML File does not reflect changes upon reopen - HELP

CHUN-YIU LAM chun_lam at hotmail.com
Fri Jan 10 21:22:29 EST 2003


This sounded like because the page was cached.  Maybe try using socket and 
read in that way if you are not using a proxy server.

Matthew

----Original Message Follows----
From: "Phil Powell" <soazine at erols.com>
Reply-To: talk at nyphp.org
To: NYPHP Talk <talk at nyphp.org>
Subject: [nycphp-talk] XML File does not reflect changes upon reopen - HELP
Date: Thu,  9 Jan 2003 01:53:40 -0500
Received: from mc7-f11.law1.hotmail.com ([65.54.253.18]) by 
mc7-s8.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 8 Jan 
2003 22:58:18 -0800
Received: from parsec.nyphp.org ([66.250.131.26]) by 
mc7-f11.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Wed, 8 Jan 
2003 22:58:18 -0800
Received: from nyphp.org (parsec.nyphp.org [66.250.131.26])by 
parsec.nyphp.org (8.12.6/8.12.6) with ESMTP id h096reSt033750;Thu, 9 Jan 
2003 01:53:40 -0500 (EST)(envelope-from listmaster at nyphp.org)
Message-Id: <200301090653.h096reSt033750 at parsec.nyphp.org>
X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=2197>
X-List-Software: Paralist 0.6
List-ID: <nyphptalk.nyphp.org>
List-Owner: <mailto:listmaster at nyphp.org>
List-Archive: <http://nyphp.org/list/paralist_archive.php?L_lid=1>
List-Subscribe: <http://nyphp.org/list/>
List-Unsubscribe: <http://nyphp.org/list/>
Organization: New York PHP
X-Mailer: Paramail 0.5
Return-Path: listmaster at nyphp.org
X-OriginalArrivalTime: 09 Jan 2003 06:58:18.0296 (UTC) 
FILETIME=[7D394B80:01C2B7AC]

if ($isValid) {
     $cgi = '/cgi-bin';
     if (strpos($HTTP_HOST, 'dyndns') === false) $cgi .= '/cgiwrap/ppowell';
     $fileID = 
fopen("http://$SERVER_NAME$cgi/pollinsert.cgi?pollID=$pollID&answerID=$answerID&valIdentifier=" 
. urlencode($valIdentifier) . "&lastPollResultsID=" . 
($pollResultsArray[sizeOf($pollResultsArray) - 2][attributes][ID] + 1), 'r')
      or die('Could not open CGI');
     $result = fread($fileID, 100000);
     fclose($fileID);
     if (trim(strtoupper($result)) != 'DONE') die ("Problem with TCL CGI 
writing to file: $result");
     // RE-PARSE XML CONTENTS SINCE ADDING NEW POLL ANSWER
     unset($pollResultsArray); unset($pollResultsXMLStuff);
     $fileID = fopen('/users/ppowell/web/xml/pollresults.xml', 'r') or 
die('Could not reopen file');
     $pollResultsXMLStuff = fread($fileID, 
filesize('/users/ppowell/web/xml/pollresults.xml'));
     fclose($fileID);
     $parser = xml_parser_create();
     xml_parse_into_struct($parser, $pollResultsXMLStuff, $pollResultsArray, 
$tags);
     xml_parser_free($parser);
    } else {
     // REDIRECT BACK TO POLL IF
     header("Location: 
http://$SERVER_NAME/poll/poll.php?pollID=$pollID&errorMsg=" . 
urlencode($errorMsg));
    }
    // END OF FORM PLACEMENT

   }

I am making changes to an XML file (and the only way I can, unless anyone 
knows how in PHP I can write TO an XML file!!! is to use a TCL CGI script to 
write to the XML file), once changes have been made I need to reopen the 
file and read its contents, however, every time I do I am getting OLD file 
information and NOT my changes, every single time, unless I refresh my 
page...

Does anyone know what I can do about this? I can't redirect them, that would 
be horribly inefficient.. what can I do?

Thanx
Phil



--- Unsubscribe at http://nyphp.org/list/ ---


_________________________________________________________________
Help STOP SPAM: Try the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail




More information about the talk mailing list