Hi i'm having problems with some code that imports tribalwars data into my DB, i know this code worked on my old server (php 4) but now that i have moved to a new one using php5.2 i get errors and i have googled for an hour and not found the answer :-)
this is the code;
<?php
include '../config/config.php';
$lines = gzfile('http://en33.tribalwars.net/map/village.txt.gz', 'r');
if(!is_array($lines)) die("File could not be opened");
echo "</br>Clearing village database</br>";
mysql_query("truncate w1_villages");
foreach($lines as $line) {
list($id, $name, $x, $y, $player, $points, $rank) = explode(',', $line);
$name = urldecode($name);
$name = addslashes($name);
$y2=$y-($y%100);
$x2=$x-($x%100);
$continent=$y2/10+$x2/100;
mysql_query("INSERT INTO w1_villages SET id='$id', name='$name', x='$x', y='$y', player='$player', points='$points', rank='$rank', continent='$continent'");
}
?>
and the error is;
Warning: gzfile() expects parameter 2 to be long, string given in /home/a9315141/public_html/crons/w1_village.php on line 5
File could not be opened
please help before i start to cry and pull more of my hair out.