However, sigh, IE seems to have a bug so that Acrobat Reader is only loaded when the URL ends with ".pdf" aka IE doesn't give a rats about the header sent to it. Using Telnet I can see that the pdf page is returned correctly but when using IE I still get a blank page due to the fact that no (pre-generated) pdf document is sent to it and therefore the URL doesn't contain a "whatever.pdf" ind the end and therefore doesn't load Acrobat Reader. Look at this example:
header("Content-Type: application/pdf"); flush(); passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage \"http://localhost/whatever.html\""); This works fine with Telnet (where output is nonsense), but doesn't with IE (where the output would make sense). Does anyone have a solution to this? How to get IE to understand that the data sent to it is to be handled as a pdf document (as in load Acrobat Reader)? "Sviss Cobazor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It seemed that it was Putty itself that wouldn't work for me (don't ask me > why). > So I used Telnet and it worked. > After having my advicor (this is a education project) visiting me we found > out why that passthru() function didn't work. > It's very simple really, passthru() doesn't allow spaces in paths so > "C:\program files\etc." becomes "C:\program" => false path. > Removing the application (htmldoc.exe) to "C:\" instead did the job. > > For anyone else having same problems this is the correct way to type it (my > example): > > <? > function topdf($filename, $options = "") { > header("Content-Type: application/pdf"); > flush(); > passthru("C:\htmldoc -t pdf14 --quiet --jpeg size A4 --webpage $options > \"$filename\""); > } > ?> > > This function now works and sends the result pdf directly to the browser. > > Thanks for your time Court, I wouldn't have thought of using Telnet myself > :) > > ~ Sviss > > "Court Shrock" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > To explain the 400 bad request, you most likely had a typo when you typed > in > > the HTTP request. The request is case-sensitive and very particular. > Most > > likely, the "Host: localhost" portion of the request messed up somehow. > > > > When you get a "HTTP/1.1 200 OK" response, that means that the webserver > > accepted the request and will process your request. In order to test > > whether or not the passthru function is doing things properly, you are > > verifying what is being sent to the browser by simulating what the browser > > would send to your webserver and then what the browser is getting in > > response. It will all start to make sense when you start seeing your > files > > output--of course, in the request that I had you type, I assumed the file > > that returns the pdf is named "index.php" or whatever file your webserver > > will retrieve when it gets a root "/" request. If this is not the case, > you > > need to replace the "GET / HTTP/1.1" line with "GET /yourfile.php > HTTP/1.1" > > or even "GET /yourfile.php?var1=whatever__yougettheidea HTTP/1.1". > > > > passthru is working properly if you see something like: > > HTTP/1.1 200 OK > > Date: Mon, 25 Feb 2002 23:20:35 GMT > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6 > > X-Powered-By: PHP/4.0.6 > > Transfer-Encoding: chunked > > Content-Type: application/pdf > > > > [lots of binary data] > > > > it isn't working if you see something like this: > > HTTP/1.1 200 OK > > Date: Mon, 25 Feb 2002 23:20:35 GMT > > Server: Apache/1.3.20 (Unix) PHP/4.0.6 mod_ssl/2.8.4 OpenSSL/0.9.6 > > X-Powered-By: PHP/4.0.6 > > Transfer-Encoding: chunked > > Content-Type: text/html > > > > <html>some stupid html, or nothing at all</html> > > > > in which case, I would try a different method to verify that data is > > properly passing between php and htmldoc.exe. > > > > I hope this has addressed some of the confusion. > > Court > > > > > -----Original Message----- > > > From: Sviss Cobazor [mailto:[EMAIL PROTECTED]] > > > Sent: Monday, February 25, 2002 5:12 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [PHP-WIN] passthru() on Win98 ?? > > > > > > > > > I followed your instructions and got: > > > > > > HTTP/1.1 400 bad request > > > > Date: Tue, 26 Feb 2002 01:05:57 GMT > > > > Server: Apache/1.3.20 (Win32) > > > > Connection: close > > > > Content-Type: text/html charset=iso-8859-1 > > > > > > ... And then the same in html source ... (in the putty window) > > > > > > So I didn't get what was expected but either way I'm not sure > > > what to do if > > > I did. > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php