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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Burton333
Forum Newbie
Posts: 15
Joined: Wed Apr 01, 2009 7:04 pm

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

Post 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
tech603
Forum Commoner
Posts: 84
Joined: Thu Mar 19, 2009 12:27 am

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

Post 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
Burton333
Forum Newbie
Posts: 15
Joined: Wed Apr 01, 2009 7:04 pm

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

Post 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.
Post Reply