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

Reply via email to