This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Read in the contents of a file located on a webserver.  RSS feed

Philippe Perrault
Posts: 1
Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At line 6 I am getting a return of null for the very first line of the Linkage.php file. When I tested the code with the file on my harddrive there were no issues and it read the line into my String variable. Now that I have put the file out on the webserver it just returns null. I have confirmed that the URL path is correct. Am I improperly using the IO class to read the file in when the file is located at a URL because I should be getting "<?php" for the first line?

The goal of this code is to obtain the information about the location, port, and type of database (mySQL, etc) and allow the applet to open a connection to the database so it can retrieve some values stored there and initialize properly.

Update: I changed my URL from the below to and it worked. So I've narrowed the issue down to the file itself. I created an identical file called Linkage.txt and changed the url to reference that file. It read in everything the way it was supposed to. So nothing wrong with the I/O & Stream code. Now wandering a little off topic: Any ideas as to why the php file is being seen as null?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!