NoMansLand Posted May 10, 2009 Share Posted May 10, 2009 Hello, I need something different from gzfile(), as my webhost has decided to disable it, So yeah 29% of my scripts now dont work.. i really want to kick them hard. Here is the code: $lines = gzfile('http://en26.tribalwars.net/map/village.txt.gz'); if(!is_array($lines)) die("File could not be opened"); foreach($lines as $line) { list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line); $name = urldecode($name) So i need to open that file, explode it.. blah blah blah, insert it into the database. So i need something new instead of gzfile() Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/ Share on other sites More sharing options...
Daniel0 Posted May 10, 2009 Share Posted May 10, 2009 Is the entire zlib extension disabled, or is it just that particular function? Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831033 Share on other sites More sharing options...
NoMansLand Posted May 10, 2009 Author Share Posted May 10, 2009 I have tried: file() gzfile() fopen() all closed. they recommended: file_get_contents() Tried it but still no luck. anyone with 3iX? Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831038 Share on other sites More sharing options...
Daniel0 Posted May 10, 2009 Share Posted May 10, 2009 You could try curl. If they've disabled all the functions for retrieving external data then you're out of luck though. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831045 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 Thanks Daniel0 your a legend, it now works. But one last question, would cURL be able to replace: $handle = fopen($base_url . "&to=$to&subject=$subject&message=$message$play$user$unplay$important$coords$x$code$y$close$space$info$newcount$space$end$space$ender", 'r'); im ready to kick my webhost. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831289 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 This is my current code: My Current Error: MySQL server has gone away. so i have re-shuffled it. and i would love some ideas, to fix this error. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://en26.tribalwars.net/map/village.txt'); $fp = fopen('village.txt', 'w'); /** * Ask cURL to write the contents to a file */ curl_setopt($ch, CURLOPT_FILE, $fp); /** * Execute the cURL session */ curl_exec ($ch); mysql_connect('localhost','********','***********') or die(mysql_error()); mysql_select_db('**********') or die(mysql_error()); mysql_query("TRUNCATE TABLE village") or die(mysql_error()); $lines = file('village.txt'); if(!is_array($lines)) die("File could not be opened"); foreach($lines as $line) { list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line); $name = urldecode($name); $name = addslashes($name); mysql_query("INSERT INTO Statement Here"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831290 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 <?php mysql_query("INSERT INTO claim (x,y,name,points,claims,days,claimer) VALUES ('$x','$y','$name','$points','$owner','$claimtime','$claimee')") or die(mysql_error()); echo "<br />"; echo "Congragulations, This Village Is Now Yours<br />"; echo "You Now Have: <strong>" . $claimtime; echo " </strong>Days To Get it Before Your Claim Expires."; $to = $claimee; $subject = urlencode('Village Claiming System: Claimed Village'); $copyright = urlencode('[b]Do Not Reply To This Message, IT IS AUTOMATIC [/b]'); $message = urlencode('Thank you for using the [ally]Pure[/ally] Village Claiming System, Remember this is not a reserving System! '); $space = urlencode('[code] '); $coords = urlencode('Co-Ordinates: [village]'); $code = urlencode('|'); $close = urlencode('[/village]'); $bpoints = urlencode('Points: '); $thankyou= urlencode('Thank you for using the Village Claiming System, Please delete this claim, once you have captured this village.'); $time = urlencode('Days Until Claim Is Deleted: '); $base_url = "http://en26.tribalwars.net/send_mail.php?from_id=152932&password=dba0079f1cb3a3b56e102dd5e04fa2af"; // go to URL $ch = curl_init(); curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou'); curl_exec ($ch); echo "<br />"; ?> [/code] The error im recieving now is: [Mon May 11 07:08:19 2009] [error] [client 58.161.150.45] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/austchat/public_html/vcsclaim.php on line 117, referer: http://www.puredomination.org/check_claim.php But i've looked all through the code, and you guys seem to be a bunch of geniuses.. So thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831475 Share on other sites More sharing options...
Potatis Posted May 11, 2009 Share Posted May 11, 2009 Is that code vcsclaim.php? What is on line 117 of vcsclaim.php? Looks like there is a missing ' here before the code bracket: $space = urlencode( '); Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831478 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 Yes thats VCS Claim, The line is: curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou'); Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831479 Share on other sites More sharing options...
Potatis Posted May 11, 2009 Share Posted May 11, 2009 I tried to edit my last post, but I cant type code in brackets because the forum creates the code background and the tag disappears. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831481 Share on other sites More sharing options...
Potatis Posted May 11, 2009 Share Posted May 11, 2009 The spaces in your URL might be giving PHP a hissy fit? My guess there is not normally spaces there, you are just replacing the password for the post. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831482 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 True, the "My Password Here" is for me to remove my password, would want some one to hack my account. But i cant see any missing '(s) Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831483 Share on other sites More sharing options...
Potatis Posted May 11, 2009 Share Posted May 11, 2009 But i cant see any missing '(s) In reply #6 you posted code. In the line that begins "$space = urlencode" there is the word code in square brackets. It looks like you have a quote mark after the end square bracket, but not before the opening bracket. But it could just be the forum screwing up because it thinks you wrote a forum bbcode tag for "code" Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831485 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 it is [-code] [/-code] Stupid TW. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831503 Share on other sites More sharing options...
Daniel0 Posted May 11, 2009 Share Posted May 11, 2009 Variable interpolation wont work in single-quoted strings. Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831514 Share on other sites More sharing options...
NoMansLand Posted May 11, 2009 Author Share Posted May 11, 2009 im at my wits end here, How am i suppose to get this to work, with out fopen, any idea's? Quote Link to comment https://forums.phpfreaks.com/topic/157599-gzfile-disabled/#findComment-831517 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.