subnet_rx Posted September 21, 2011 Share Posted September 21, 2011 I have a page that processes a variable passed in the url to go get information out of a text file in JSON format. For some reason though, passing one variable loads a page, passing a certain variable (who's data in the file is virtually identical to the first) will cause the browser to just load the page indefinitely. Maybe even more strange is that on my local machine, the variable that won't load is switched, and the other loads fine. How can I debug what's happening when the page never loads so that I never get an error? Quote Link to comment https://forums.phpfreaks.com/topic/247619-troubleshooting-a-page-that-wont-load/ Share on other sites More sharing options...
WebStyles Posted September 21, 2011 Share Posted September 21, 2011 I tried your code and it worked great.... hmmm.... Wait a minute... What code? Quote Link to comment https://forums.phpfreaks.com/topic/247619-troubleshooting-a-page-that-wont-load/#findComment-1271569 Share on other sites More sharing options...
subnet_rx Posted September 21, 2011 Author Share Posted September 21, 2011 I think I've determined this is a browser issue, but I wouldn't mind someone taking a look at the code to see if I'm doing things correctly <?php $menu_id=filter_input(INPUT_GET, 'q', FILTER_SANITIZE_NUMBER_INT); if (isset($menu_id)) { $url = "http://www.mysite.com/json/mobile_menu/".$menu_id; //load menu items $string=file_get_contents($url); $menu_object=json_decode($string); $m = $menu_object->nodes[0]; //load external links in menu $lurl = "http://www.mysite.com/json/external_links/".$menu_id; //load menu items $lstring=file_get_contents($lurl); $ext_object=json_decode($lstring); } else { header( 'Location: http://m.mysite.com/' ) ; } ?> <!DOCTYPE html> <html> <head> <title><?php print($m->menu->Menu_Title); ?></title> <?php require_once 'includes/header.inc.php'; ?> </head> <body> <div id="nid_menu" data-role="page"> <?php require_once 'includes/header_div.php'; ?> <div data-role="content"> <h1 class="menu_header"><?php print($m->menu->Menu_Title); ?></h1> <ul data-role="listview" data-dividertheme="a"> <?php if (isset($m->menu->Title)) { foreach($menu_object->nodes as $m) { if ($m->menu->Type == "mobile_menu") { echo '<li><a href="./menu.php?q='.$m->menu->Nid.'">'.$m->menu->Title.'</a></li>'; } else { echo '<li><a href="./page.php?q='.$m->menu->Nid.'">'.$m->menu->Title.'</a></li>'; } } } ?> <?php if (array_key_exists("nodes",get_object_vars($ext_object))) { ?> <li data-role="list-divider">Other Resources</li> <?php foreach($ext_object->nodes as $e) { echo '<li>'.$e->link->Link.'</li>'; }} ?> </ul> </div> <?php require_once 'includes/footer.php'; ?> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/247619-troubleshooting-a-page-that-wont-load/#findComment-1271572 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.