Jump to content

Parsing Text then inserting it into a database


Mystixs

Recommended Posts

Hey all. Sorry for making this my first post but I can't find anything to help me. And a friend said you guys could.

So, heres my problem.

I want to take this page here: http://movoda.net/api/csvranks.html and parse the text from it and place it on a Mysql Database on my host here: http://mrc.110mb.com/test

It will be done to make a more sophisticated highscores page for the game.
Once its in the database I can retrieve it and such myself. I just need to know how to parse the text on the Movoda.net website and put it into a mysql database. I have a table set up. With 4 fields. It's all ready just need to parse it. And I don't know how.

ANY help is appreciated.

Thanks,
-Mystixs

I hope this will work

$url="http://tech.groups.yahoo.com/group/strangescience/members?start=11&group=sub"
$data=file_get_contents($url);
$lines=explode("\n",$data);
foreach($lines AS $line ){
$final_data=explode(",",$line);
$data1=$final_data[0];
$data2=$final_data[1];
$data3=$final_data[2];
$data4=$final_data[3];
$data5=$final_data[4];
$query="INSERT INTO table VALUES('id','$data1','$data2','$data3','$data4','$data5')";
//Then execute this query.
}

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.