FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Need to run something...

 


polly-gone
I need to run this script:

Code:
<?php

$lines = gzfile('http://en9.tribalwars.net/map/village.txt.gz');
if(!is_array($lines)) die("File could not be opened");

$connection = mysql_connect($host, $user, $pass) or die('Unable to connect to the K11R Database');

//Select 'home' Database
mysql_select_db($db) or die('Unable to connect to the Villages Database');

foreach($lines as $line)
{
   list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
   $name = urldecode($name);

   $name = addslashes($name);
   mysql_query("INSERT INTO World9_Villages SET id='$id', name='$name', x='$x', y='$y', player='$player', points='$points', rank='$rank'");
}

mysql_close($connection);

?>


But it says that gzfile is disabled in the PHP configuration. Is there any way around that? I really need this script. Thanks.

-Nick Sad Sad Sad
kv
You can use curl to download the file first to local m/c. Then use other gz functions (like gzdeflate/gzopen/gzread etc) on the local file. Or even use system("gzip $localfile"); (if it is allowed).
Agent ME
Is "http://en9.tribalwars.net/map/village.txt.gz" your server, or are you downloading a file from someone else's server? If it's on your server, (assuming your php file is at "http://en9.tribalwars.net/***.php" in directory structure), then just say "map/village.txt.gz" to reference the file.
When you reference the file with "http://" at the start, the php script on the server will actually open an http connection to the server on the same computer and retrieve the file to temporary memory. This takes up more resources and is apparently not allowed on the system you're on.
polly-gone
No. It is not my server.

-Nick Smile Smile Smile
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.