Page 1 of 1

Obtaining specific information from a URL(ending in .txt)

Posted: Mon Apr 13, 2009 6:08 pm
by Burton333
Hi I have read about the file(), implode(), and other functions used to obtain information from a file or URL. I am trying to use php in order to obtain the file from the URL, and then I am trying to parse the information into different substrings using Java in order to insert them into a database. Can someone please help me out or lead me in the right direction at least? I have a comma-delimited format in order to make it easier to parse. If it helps the URL is :
http://giraffe.uvm.edu/~rgweb/batch/cur ... l_fall.txt

Re: Obtaining specific information from a URL(ending in .txt)

Posted: Mon Apr 13, 2009 6:21 pm
by tech603
If your wanting to read the text file, then i would suggest not going to the text file as a link, rather opening a php page that will read the text file based on what you specify in the browser. For example:

instead of going to this link
http://giraffe.uvm.edu/~rgweb/batch/cur ... l_fall.txt

do something like this http://giraffe.uvm.edu/~rgweb/batch/rea ... nroll_fall

Code: Select all

 
<?php
 
if(isset($_GET['file'])){
$file = "file location/" . $_GET['file'] . ".txt";
}
 
/* use php to read file */
 
Here is the php manual for reading a file
http://www.php.net/readfile

Hope that helps

Re: Obtaining specific information from a URL(ending in .txt)

Posted: Mon Apr 13, 2009 6:31 pm
by Burton333
I have it reading the file, but now how do I go about passing the variable (ie. $fileName) to Java in order to parse the string accordingly into individual variables? This way I can pass each one into a field in a database(ie. Dept, #, Title, etc.). I am doing it like this so that I can have it constantly updated, so there is an accurate number of students enrolled in each class.