Brute Posted December 17, 2012 Share Posted December 17, 2012 print_r: Array ( [public] => Array ( [currentVersion] => 162 [dedicated] => 1 [difficulty] => 1 [equalModRequired] => 0 [gameState] => 7 [gamemode] => openplaying [gamename] => arma2oapc [gametype] => RP [gamever] => 1.62.95251 [gq_address] => 85.236.98.102 [gq_dedicated] => 1 [gq_gametype] => RP [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [gq_mapname] => tavi [gq_maxplayers] => 85 [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [gq_numplayers] => 0 [gq_online] => 1 [gq_password] => 2 [gq_port] => 2302 [gq_protocol] => gamespy3 [gq_transport] => udp [gq_type] => armedassault2oa [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [language] => 65545 [mapname] => tavi [maxplayers] => 85 [mission] => Life Project RPG [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03 [numplayers] => 0 [numteams] => 0 [param1] => 0 [param2] => 0 [password] => 2 [platform] => win [players] => Array ( ) [reqBuild] => 0 [reqSecureId] => 0 [requiredVersion] => 162 [signatures] => [sv_battleye] => 1 [teams] => Array ( ) [timelimit] => 15 [verifySignatures] => 0 ) ) I can't figure out how to get elements like gq_numplayers out by themselves so I can echo them. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/ Share on other sites More sharing options...
Christian F. Posted December 17, 2012 Share Posted December 17, 2012 If you click on "view source", you'll get the data in a much easier to read representation. Either that, or add echo "<pre>"; in front of the print_r () call. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399887 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 Array ( [public] => Array ( [currentVersion] => 162 [dedicated] => 1 [difficulty] => 1 [equalModRequired] => 0 [gameState] => 7 [gamemode] => openplaying [gamename] => arma2oapc [gametype] => RP [gamever] => 1.62.95251 [gq_address] => 85.236.98.102 [gq_dedicated] => 1 [gq_gametype] => RP [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [gq_mapname] => tavi [gq_maxplayers] => 85 [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [gq_numplayers] => 0 [gq_online] => 1 [gq_password] => 2 [gq_port] => 2302 [gq_protocol] => gamespy3 [gq_transport] => udp [gq_type] => armedassault2oa [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [language] => 65545 [mapname] => tavi [maxplayers] => 85 [mission] => Life Project RPG [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03 [numplayers] => 0 [numteams] => 0 [param1] => 0 [param2] => 0 [password] => 2 [platform] => win [players] => Array ( ) [reqBuild] => 0 [reqSecureId] => 0 [requiredVersion] => 162 [signatures] => [sv_battleye] => 1 [teams] => Array ( ) [timelimit] => 15 [verifySignatures] => 0 ) ) That's what I've got, I still have to idea how to pull elements out of these arrays though Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399897 Share on other sites More sharing options...
Jessica Posted December 17, 2012 Share Posted December 17, 2012 $arr['public']['gq_numplayers']; Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399904 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 That works, thank you! However echo $results['public']['players']['0']['player']; that doesn't work for this: Array ( [public] => Array ( [currentVersion] => 162 [dedicated] => 1 [difficulty] => 1 [equalModRequired] => 0 [gameState] => 7 [gamemode] => openplaying [gamename] => arma2oapc [gametype] => RP [gamever] => 1.62.95251 [gq_address] => 85.236.98.102 [gq_dedicated] => 1 [gq_gametype] => RP [gq_hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [gq_mapname] => tavi [gq_maxplayers] => 85 [gq_mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [gq_numplayers] => 1 [gq_online] => 1 [gq_password] => 2 [gq_port] => 2302 [gq_protocol] => gamespy3 [gq_transport] => udp [gq_type] => armedassault2oa [hash] => BB57B402D92E05CF1B7EE1E351E45350449A929B [hostname] => Life Project RPG Alpha Testing www.lifeprojectrpg.com [language] => 65545 [mapname] => tavi [maxplayers] => 85 [mission] => Life Project RPG [mod] => Arma 2: British Armed Forces (Lite);Arma 2: Private Military Company (Lite);Arma 2: Operation Arrowhead;Arma 2;@CBA;@CBA_A2;@CBA_OA;@Arma2NET;@LifeProject;@LifeProjectMOD [modhash] => 993414a99da37d9b35ea3cf165af19b319b26ec3;98c8b2464fa39ff1ac38ea7db8f96ea02e5ea76d;da39a3ee5e6b4b0d3255bfef95601890afd80709;8d15d603cca8999344e01c1719c293053db5962d;d5af993459674089a8da572ab84c0bb807769227;ad5168fec24a4ce539315483487ce472cb63c7d3;;01a7de012d75ad0f4adb45c885cb9c8ab2636963;PMC v. 1.02;BAF v. 1.03 [numplayers] => 1 [numteams] => 0 [param1] => 0 [param2] => 0 [password] => 2 [platform] => win [players] => Array ( [0] => Array ( [player] => Polaris [score] => 0 [deaths] => 0 [gq_name] => [gq_kills] => [gq_deaths] => 0 [gq_score] => 0 [gq_ping] => ) ) [reqBuild] => 0 [reqSecureId] => 0 [requiredVersion] => 162 [signatures] => [sv_battleye] => 1 [teams] => Array ( ) [timelimit] => 15 [verifySignatures] => 0 ) ) Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399918 Share on other sites More sharing options...
TOA Posted December 17, 2012 Share Posted December 17, 2012 [player] => Polaris You have a weird character in there that is probably your issue. Find where that's coming from and eliminate it. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399920 Share on other sites More sharing options...
Jessica Posted December 17, 2012 Share Posted December 17, 2012 0 != '0' Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399921 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 I don't see a weird character? Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399922 Share on other sites More sharing options...
mrMarcus Posted December 17, 2012 Share Posted December 17, 2012 (edited) . Edited December 17, 2012 by mrMarcus Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399923 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 echo $results['public']['players'][0]['player']; still doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399924 Share on other sites More sharing options...
Jessica Posted December 17, 2012 Share Posted December 17, 2012 What happens when you do a print_r on $results['public']['players'][0]? What about $results['public']['players']? and $results['public']? You need to try to do a little debugging now. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399925 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 It seems to be an issue specifically with 'player' because 'score' works... Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399926 Share on other sites More sharing options...
mrMarcus Posted December 17, 2012 Share Posted December 17, 2012 (edited) There is a funny character prepended to player: http://s9.postimage....t9tb/Image1.jpg Edited December 17, 2012 by mrMarcus Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399929 Share on other sites More sharing options...
TOA Posted December 17, 2012 Share Posted December 17, 2012 I don't see a weird character? Really? [player] => Polaris Could just be from your posting online. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399930 Share on other sites More sharing options...
TOA Posted December 17, 2012 Share Posted December 17, 2012 (edited) There is a funny character prepended to player: http://s9.postimage....t9tb/Image1.jpg That's what I told him several posts ago... Edited December 17, 2012 by TOA Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399931 Share on other sites More sharing options...
mrMarcus Posted December 17, 2012 Share Posted December 17, 2012 That's what I told him several posts ago... Just noticed that. I didn't see it myself until I pasted his array to my editor. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399932 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) I can't see it in the browser but it is in the source...what the hell is that character lol. echo $results['public']['players'][0]['player']; That works :s Edited December 17, 2012 by Brute Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399933 Share on other sites More sharing options...
TOA Posted December 17, 2012 Share Posted December 17, 2012 Just noticed that. I didn't see it myself until I pasted his array to my editor. I'm glad I wasn't the only one who noticed...might have been crazy I can't see it in the browser but it is in the source...what the hell is that character lol. echo $results['public']['players'][0]['player']; That works :s Most likely a byte-order mark or something. Wherever you make that array key, it's adding something in there. We'd need to see some code to help find it. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399934 Share on other sites More sharing options...
Jessica Posted December 17, 2012 Share Posted December 17, 2012 I'm glad I wasn't the only one who noticed...might have been crazy Are you guys seeing it in your browser? I'm using Chrome and I don't see it. I see it in the screencap obv. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399935 Share on other sites More sharing options...
mrMarcus Posted December 17, 2012 Share Posted December 17, 2012 Are you guys seeing it in your browser? I'm using Chrome and I don't see it. I see it in the screencap obv. No, not in the browser. Copied his array over to Notepad++ and was able to see it. I'm on Chrome also. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399937 Share on other sites More sharing options...
Brute Posted December 17, 2012 Author Share Posted December 17, 2012 I didn't write the scripts that grab the information so I have no idea, I mean i'd like to fix it but I have absolutely no idea what to look for . You can get the scripts I'm using here https://github.com/Austinb/GameQ. Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399938 Share on other sites More sharing options...
mikosiko Posted December 17, 2012 Share Posted December 17, 2012 In Chrome... select the text... right click on it... and the contextual "Search..." will show it Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399940 Share on other sites More sharing options...
TOA Posted December 17, 2012 Share Posted December 17, 2012 Are you guys seeing it in your browser? I'm using Chrome and I don't see it. I see it in the screencap obv. I am. It shows in his posted code for me. IE 8 on XP Quote Link to comment https://forums.phpfreaks.com/topic/272104-cannot-get-elements-out-of-this/#findComment-1399941 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.