bftwofreak Posted July 23, 2008 Share Posted July 23, 2008 Like I posted earlier, I'm working on a script to display my member's halo 3 stats. I've currently accessed the file, but I'm trying to hide the contents of the file. This is what I'm currently using: <?php if (!defined('MODULE_FILE')) { die('You can\'t access this file directly...'); } define('INDEX_FILE', true); $module_name = basename(dirname(__FILE__)); $text = 'test...'; if (isset($_REQUEST['player'])) { $url = 'http://www.bungie.net/stats/Halo3/default.aspx?player=' . $_REQUEST['player']; $file = '<div style="visibility:hidden;">'; $file = file_get_contents($url); $file .= '</div>'; $body = $text; } else { $url = 'tag.html'; $file = file_get_contents(NUKE_MODULES_DIR . $module_name . '/' . $url); $body = ''; } include('header.php'); OpenTable(); echo $file; echo $body; CloseTable(); include('footer.php'); ?> Is there an easier way to hide the text or another way because this isn't working. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/ Share on other sites More sharing options...
ratcateme Posted July 23, 2008 Share Posted July 23, 2008 why do you need to hide the file? it looks unnecessary in the example you posted Scott. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597211 Share on other sites More sharing options...
ratcateme Posted July 23, 2008 Share Posted July 23, 2008 the code you posted will fail because this line $file = file_get_contents($url); will overwrite $file change it to $file .= file_get_contents($url); to keep the div that hides it Scott. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597214 Share on other sites More sharing options...
bftwofreak Posted July 23, 2008 Author Share Posted July 23, 2008 Technically the code is unfinished. I'm going to add a javascript file in to "screen scrape" the contents from the bungie stats page, but I don't want my users to actually see the bungie page contents itself. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597216 Share on other sites More sharing options...
bftwofreak Posted July 23, 2008 Author Share Posted July 23, 2008 and yes I know that, I was testing it without the <div> tags around it. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597217 Share on other sites More sharing options...
ratcateme Posted July 23, 2008 Share Posted July 23, 2008 it is more of a html question then but i think you are using the best method Scott. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597220 Share on other sites More sharing options...
bftwofreak Posted July 23, 2008 Author Share Posted July 23, 2008 oh ok. I get it now.. ha. the <div style="visibiliity: hidden;"> was overwritten by the get_file_contents(); command. got it. whoops... the only issue now is that it leaves this giant blank space where the page contents were... any way to get rid of that space? Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597222 Share on other sites More sharing options...
ratcateme Posted July 23, 2008 Share Posted July 23, 2008 i don't know you could save the text into a javascript var and then replace it with "" again not a php question more a html question Scott. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597226 Share on other sites More sharing options...
bftwofreak Posted July 23, 2008 Author Share Posted July 23, 2008 lol sorry. It technically related to php so I posted it here, plus I didn't feel like waiting til next week while there's no one in the html forum, but I'll attempt it and if it doesn't work, I'll repost in the html or javascript forum. Thanks for the fix though. Link to comment https://forums.phpfreaks.com/topic/116137-solved-hide-the-contents-of-file_get_contents/#findComment-597229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.