FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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
Related topics
Resources are about to run out. What are we to do?..
run into pictures
TI-Connect software won't run on my xp
How to run a cron job on a server
Error when Mozilla is run
Inzamam's run out
Run a server app?
Run Linux applications on Windows?
Why Doesn`t Nvu Run on My Computer?
Man Leaves Job to Run 50 Marathons
Run a exe file in HTML(not download, run it)
how to run 2 domain from a single hosting account?
modifiying the windows registry with the windows API - run
My PC is SO Slow!!!
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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