RE: [PHP] Problem with Printer-friendly script

From: Date: Fri, 04 Jan 2002 12:27:14 +0000
Subject: RE: [PHP] Problem with Printer-friendly script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-79451@lists.php.net to get a copy of this message
I don't, because if MySQL caused the problem you would see it on the original page. I'venot worked with fsockopen(), is there any way you can test it without hitting the database, which may be causing a delay? What I'm thinking is to take the page created in the original call (www.ski-info-online.com/skiResort-print1.php?id=Alpbach), store it as straight HTML, then call it using the same technique used in the "Printer Friendly" code. This is puzzling. Miles At 07:53 AM 1/4/2002 +0000, Torrent wrote:
Oh, btw, the data is extracted from a MySQL database. How do you see that affecting the problem? Tx Torrent www.ski-info-online.com -----Original Message----- From: Miles Thompson [mailto:milesthompson@ns.sympatico.ca] Sent: 04 January 2002 01:30 To: ski-info@ski-info-online.com; php-general@lists.php.net Subject: Re: [PHP] Problem with Printer-friendly script It's reasonably fast in Internet Explorer, and didn't complete in Netscape 4.7. The characters I saw were similar to yours, except that I saw fd0 (the floppy!?) instead of fd6. Could they be artifacts in the data stream? Does the initial page, www.ski-info-online.com/skiResort-print1.php?id=Alpbach fetch data from a database? from a flat file? What happens if you fetch the default length of 1k? Miles Thompson At 12:30 AM 1/4/2002 +0000, ski-info wrote: I am in the process of producing a script which will allow me to produce printer-friendly versions of my dynamically produced web pages. For the most part it is working but take a look here... www.ski-info-online.com/skiResort-print1.php?id=Alpbach If you click the "Print Review" button it all seems to work fine, except 1) it's slow and... 2) do you see those numbers c3 fd6 and 52 59c (may take a few seconds)? Where on Earth did they come from? They are not in the html (as you would also see them on the main review page). They also appear to be the cause of the script running slow. Here is my php code. PHP:----------------------------------------------------------------------- - -------- <? header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modifieed: ". gmdate("D, d M Y H:i:s"). " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0,pre-check=0"); header("Cache-Control: max-age=0"); header("Pragma: no-cache"); if ($HTTP_REFERER){
    $myURL = $HTTP_REFERER;
} else {
    $myURL = "http://www.ski-info-online.com/";
} $START_CONT="<!-- CONTENT STARTS -->"; $END_CONT = "<!-- CONTENT ENDS -->"; $parsed_url = parse_url($myURL); $myServer = $parsed_url['host']; $document = $parsed_url['path']; $query = $parsed_url['query']; if($document[strlen($document)-1]=='/'){
    $document = "$document/index.php";
    $base_url = dirname($document);
} $fp=fsockopen($myServer,80,&$errno,&$errstr,30); $request = "GET $document"."?"."$query"." HTTP/1.1\r\n"; $request .= "Host: $myServer\r\n\r\n"; if(!$fp) { echo "$errstr ($errno)<br>\n"; } else { fputs($fp,$request); $content=0; $in_title=0; ?> <? while(!feof($fp)) { $line=fgets($fp,4096); if(ereg($START_CONT,$line)) { $content=1; } if(ereg($END_CONT,$line)) $content=0; if($content==1)echo $line; } fclose($fp); ?> ---------- Copyright © Ski-Info-Online.com. All rights reserved. <?echo "$myURL\n";?> <? } ?> --------------------------------------------------------------------------- - ---- Any help greatly appreciated. Torrent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#79451) next »