RE: [PHP] Java applet can't read PHP output !!
| From: | Andrew Braund | Date: | Tue, 03 Apr 2001 21:10:07 +0000 |
| Subject: | RE: [PHP] Java applet can't read PHP output !! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-46897@lists.php.net to get a copy of this message | ||
Try putting \n at the end of each line of your php print, your applet
is using readline() so waiting for newline character (\n).
hth
Andrew Braund
> -----Original Message-----
> From: Peter Choynowski [mailto:pkc@scs.carleton.ca.nospam]
> Sent: Wednesday, 4 April 2001 06:08
> To: php-general@lists.php.net
> Subject: [PHP] Java applet can't read PHP output !!
>
>
>
> 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
>