ok, first the short, straight answer: You won't achieve what you want with this approach.
The purpose of
echo is to add something to the output stream. If you're running php as console-application the output stream is the console (it will be printed there).
If php is running as a module/cgi for a webserver the output stream (maybe with some redirections) is what the client -waiting for the response document- receives. The script
Code: Select all
<?php
echo '<html>';
echo ' <head>';
echo ' <title>test</title>';
echo ' </head>';
echo ' <body>';
echo ' nothing important';
echo ' </body>';
echo '</html>';
?>
and the plain html-file
Code: Select all
<html>
<head>
<title>test</title>
</head>
<body>
nothing important
</body>
</html>
will
produce the same output and the client will (probably) parse and display it as html. They are indistinguishable for the client. Only the output matters (ok, there's also the response-header, but that's negligible for now).
That's what I meant with
Open the source view of your browser; what you see there is what the client does.
. Just try it, it will be the same for both files.
Creating a java-frame adds nothing to the output stream. The window (if it could be instantiated/made visible) is bound to the systems that called the function/method/constructor. And in your case that's the server.
The reason it does not show up when server and client are the same machine is probably that the webserver's process is not attached to the
gui or not allowed to interact with it.
(only out of curiosity: which webserver/os do you use?)