Connecting Tech Pros Worldwide Forums | Help | Site Map

parseing text file from web server

Newbie
 
Join Date: Feb 2007
Posts: 2
#1: Feb 26 '07
I play a game that has raw news feeds stored in txt on there website. located
[HTML]http://a.swirve.com/data[/HTML]
My problem is I know nothing about PHP.
The basics of what I am trying to do is scan the file, insert into a mysql database.
Right now there is a whole sets worth of data. But when the next set starts there wont be that many files, or same file names used. The one thing that stays the same is the next to last file is the current hour of news. I am hoping to scan the txt files once every 5 mins. Any help would be appreciated.

Newbie
 
Join Date: Feb 2007
Posts: 2
#2: Feb 26 '07

re: parseing text file from web server


[PHP]<?php
$filename = "personal.txt";
$data = file( $filename );
foreach( $data as $jai )
]
{ [/PHP]

Thats what I have so far to open the txt file. Thou I not sure how to get that open the 2nd from the bottom file.

I got some help with inserting into mysql database

[PHP]
$jaiql = mysql_query("INSERT msql_table VALUES ('', '{$jai[0]}', '{$jait[3]}', '{$jait[7]}', '{$jai[1]}', '{$jai[2]}', '{$jai[3]}', '{$jai[4]}', '{$jai[5]}', '{$jai[6]}', '{$jai[7]}', '{$jai[8]}')");

print("$jai[0]--$jait[3]--$jai... -- $jai[4] -- $jai[5] - $jai[6] - $jai[7] - $jai[8]");
[/PHP]
Reply


Similar PHP bytes