RE: [PHP] Problem with Printer-friendly script
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 +, 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:[EMAIL PROTECTED]] Sent: 04 January 2002 01:30 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 +, 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Problem with Printer-friendly script
Appreciate the help on this one. I have not worked with fsockopen before either (I only started php about 6 weeks ago which also doesn't help). I am almost certain the delay isn't with the database because at the point where the pause is the query has already been executed and the result returned (all of that page's content comes from the Db). Thanks for the suggestion though. Do you know of another way I could accomplish this? Someone on my site's forum suggested that I could perhaps use fpassthru(). I've not used this function before but thought I would take a look at it. What do you think? Also, I have noticed that if I select different resorts I get different hex numbers come up. So it must have something to do with the content. I checked to see if the numbers were equivalent to the number of characters upto that point (including any html tags) but they are way off. This is stumping a lot of people. Thanks again for your help with this. Torrent -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: 04 January 2002 12:27 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Problem with Printer-friendly script 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 +, 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:[EMAIL PROTECTED]] Sent: 04 January 2002 01:30 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 +, 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail
RE: [PHP] Problem with Printer-friendly script
Problem is now resolved :-) In the end I swapped the fsockopen() for an fopen(). This seemed to fix it up a treat. Thanks for all your help. Torrent -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: 04 January 2002 01:30 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 +, 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem with Printer-friendly script
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; ? HTML HEAD BASE HREF=? echo http://$myServer$base_url/;; ? link rel=stylesheet href=printable.css ? 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); ? HR CENTER SMALLCopyright copy; USki-Info-Online.com/U. All rights reserved./SMALLBR ?echo A HREF=\$myURL\SMALLI$myURL/I/SMALL/A\n;? /CENTER /BODY /HTML ? } ? Any help greatly appreciated. Torrent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Problem with Printer-friendly script
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:[EMAIL PROTECTED]] Sent: 04 January 2002 01:30 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 +, 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Problem with Printer-friendly script
Thanks Miles, I think you are right regarding them being artifacts in the data stream. I have been searching the Net for similar problems but there is surprisingly little around for fsockopen(), even php.net's manul page doesn't have any notes contributed by any users. I will certainly try the the default of 1K and see what I get. Thanks again, Torrent www.ski-info-online.com -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: 04 January 2002 01:30 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] 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 +, 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]