Jump to content

Java equivalent of PHP code


dontknowmuch

Recommended Posts

my java is very rusty and I have nowhere to test this out but I hope it at least points you in the right direction

//equivalent of //$html = file_get_contents("http://www.google.com/index.html");String html = "";InputStream in = null;try {	in = new BufferedInputStream		(new FileInputStream(root + "/message.txt") );	int ch;	while ((ch = in.read()) !=-1) {		html += String.valueOf((char)ch);	}}finally {	if (in != null) in.close();  // very important}//echo "html: <br>" . nl2br(htmlentities($html));OutputStream out = response.getOutputStream();out.write(html);

quite a bit to replace 2 php lines huh?

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...