Re: Java applet can't read PHP output !!
| From: | Lindsay Adams | Date: | Tue, 03 Apr 2001 20:41:54 +0000 |
| Subject: | Re: Java applet can't read PHP output !! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46889@lists.php.net to get a copy of this message | ||
Umm, have you tried explicitly outputting the content-type header the way
your shell script does?
See header() in the php docs.
On 4/3/01 1:38 PM, "Peter Choynowski" <pkc@scs.carleton.ca.nospam> wrote:
>
> I am using php4 as an Apache module. The problem is that when a Java
> applet makes a connection to a CGI script written in php, it can't read
> the result of php output, but the same applet works fine with Perl or
> plain sh CGI script - since the only difference between the the CGIs is
> the language used ie. php, perl,... I am speculating that the problem is
> somewhere in the Apache-php interface ( the strange thing is that the
> php script works if connected to with a browser :-( )
>
> Here is some simple code ( working sh code )
>
> in sh
> #! /bin/sh
> echo "Content-type: text/plain"
> echo ""
> echo "some text..."
>
> The following output displays with a browser, but can't be read by a
> Java applet
> <?php
> print "some text ..."
> ?>
>
>
> Applet code in question:
> URL u=new URL("http://www/test.php");
> URLConnection uc=u.openConnection();
> DataInputStream d=new DataInputStream(uc.getInputStream());
> while ( (line=d.readLine()) != null ) {
> System.out.println(line);
> }
>
> I tried set_time_limit(0), ignore_user_abort, sending my own header with
> header function, none of them worked - any ideas ?
>
> Thanks,
> Peter
>
>
>