Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use a variable's value from another page?

Status
Not open for further replies.

cbsarge

IS-IT--Management
Jun 20, 2001
219
US
I'm not sure if PHP is the right way to do this so if it's not please tell me :)

I'd like to create a webpage where someone can go an plug in a link to a replay page from a game I play. Normally this page just shows the battle scene. The page also contains a variable named fvars that contains all the individual attacks, how much damage they did, etc. I'd like to grab the value of fvars to give a much more detailed analysis of the battle. Is this possible? I'd like to use a form with a submit button so the user can plug in the link and then click submit and be taken to the analysis page. Again, I don't know if PHP is the best way to do this but, so far I've read about the file_get_contents command which I believe captures the html of the page and puts it in a variable. Can I then call the variable (fvars) by it's name in some way?

This does not work but, I hope you'll get the general idea.

PHP:
<?php 
 $file = file_get_contents('[URL unfurl="true"]http://superherocity.klicknation.com/game/pages/battle_replay.php?battle=857337182');[/URL] 
 Echo $fvars;
 ?>
 
If you did not write that game page, you are just breaking in. What you ask is essentially the same as "My friend serves delicious cookies when you visit him. How can I take a picture of his house and eat the cookie?". If you did write that page, you can write a page that returns just the data you are looking for.

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
The page in question is like an "instant replay" page. They are free to share with other players so they can watch your battle. Even though the replay page only shows the animated battle scene it still contains the fvars variable that holds the sequence of attacks and how much damage they did. What I would like to offer is a more "digestible" break down of the battle with additional stats based on the number of hits, how much they did, which attacks were used, etc. Another player has a page already that does the same thing but, several times he has either password protected the page restricting it to a select few or pragmatically prevented it from showing replays against friends of his. I would like to create a similar version that will be open to all.
 
i cannot access that page to view what you mean by the 'fvars'. perhaps you could post a link that works or the raw html of the page.
 
Here is the source of the frame that contains the battle animation a swell as fvars.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		
		<title>Superhero City</title>
		
		<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
		
		<style>
			
			div.width_100{width: 100%;}
			div.flight{float: left;}
			.main{font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; width:690px;}
			body {margin:0;padding:0;background-color:#000;}
			#battlesystem_container
			{
				width:700px;
				height:460px;
                background: #000 url(//assets100.klicknation.com/apps/heros/assets/style_themes/gotham/images/arena/loaderarena.gif);
            }
			
			#battlesystem {position:relative;left:-1px;}
			
		</style>
		
	</head>
	
	<body>

		<div class="width_100 flight">
			
			<div class="flight main" style="height:470px;text-align:center;" >
			
				<div id="battlesystem_container">
					<div id="battlesystem" >_</div>
				</div>
			
			
			</div>
		
		</div>
		
		<script type="text/javascript">
		
			function BSEmbedded(e)
			{
				//alert ('BS flash installed '+e.success);
			}

            function haveCorrectFlashVersion()
            {
                var playerVersion = swfobject.getFlashPlayerVersion();

                return (playerVersion.major >= 9);
                 
            }
			
	 		var fvars = {"p1":"383640","p2":"2660363","rounds":"%5B%22528696%2C218209%2C299%2C0%2CDoomWhistle%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22572150%2C188349%2C303%2C0%2CSackAttack%2CAnarchy%2C0%2C0%2C%2C%2Cbeta%22%2C%22869089%2C291711%2C330%2C0%2CNightmareUltra%2CShadowAssault%2C0%2C0%2C%2C%2Cbeta%22%2C%22738726%2C254960%2C319%2C0%2CWipeoutFinal2%2CSoulReaper%2C0%2C0%2C%2C%2Cbeta%22%2C%22840120%2C202131%2C328%2C0%2CScatterDash%2CAnarchy%2C0%2C0%2C%2C%2Cbeta%22%2C%22637332%2C114847%2C309%2C0%2CStabbingTina%2CNightmare%2C0%2C0%2C%2C%2Cbeta%22%2C%22716999%2C135519%2C317%2C0%2CAttackoftheGreen%2CUndeadSummon%2C0%2C0%2C%2C%2Cbeta%22%2C%221042907%2C339947%2C346%2C0%2CBareKnuckleBrutality%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22934271%2C151598%2C336%2C0%2CSoulAbsorption%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22506969%2C188349%2C297%2C0%2CHeatVision2%2CDemonSummon%2C0%2C0%2C%2C%2Cbeta%22%2C%22927029%2C135519%2C336%2C0%2CNeutronium%2CVisitorsAid%2C0%2C0%2C%2C%2Cbeta%22%2C%22927029%2C222803%2C336%2C0%2CRoboBaby%2CSoulReaper%2C0%2C0%2C%2C%2Cbeta%22%2C%22724241%2C257257%2C317%2C0%2CSteelShockwave%2CBigBangExtermination%2C0%2C0%2C%2C%2Cbeta%22%2C%22825635%2C339947%2C327%2C0%2CNightmareUltra%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%7B%22name%22%3A%22%5Cu00e2%5Cu0097%5Cu0084PhX%5Cu00e2%5Cu0096%5Cu00ba+%7C-Final+Judgement-%7C%22%2C%22max_life%22%3A22644%2C%22level%22%3A%221564%22%2C%22attackVal%22%3A%22724241.1%22%2C%22agility%22%3A%22328363.1%22%2C%22teamSize%22%3A7820%2C%22item1%22%3A%22http%3A%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fattack%5C%2Fregression.jpg%22%2C%22item2%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fdefense%5C%2Ftow_7sins.jpg%22%2C%22item3%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fmovement%5C%2Fspring2012.jpg%22%2C%22auras%22%3A%5B%7B%22name%22%3A%22Protection2%22%2C%22flash_url%22%3A%22aura_protection%22%2C%22layer%22%3A%220%22%7D%2C%7B%22name%22%3A%22Fury3%22%2C%22flash_url%22%3A%22aura_fury%22%2C%22layer%22%3A%220%22%7D%2C%7B%22id%22%3A%221%22%2C%22category_id%22%3A%220%22%2C%22name%22%3A%22Test%22%2C%22magnitude_min%22%3A%221%22%2C%22magnitude_max%22%3A%2210%22%2C%22flash_url%22%3A%22testurl%22%2C%22layer%22%3A%222%22%7D%2C%7B%22id%22%3A%22319%22%2C%22category_id%22%3A%22319%22%2C%22name%22%3A%22mascot_wolfman%22%2C%22magnitude_min%22%3A%220%22%2C%22magnitude_max%22%3A%229000%22%2C%22flash_url%22%3A%22%22%2C%22layer%22%3A%221%22%7D%5D%2C%22consumables%22%3A%5B%5D%7D%2C%7B%22name%22%3A%22%26lt%3B7%26gt%3B+Lust%22%2C%22max_life%22%3A4241%2C%22level%22%3A%221000%22%2C%22attackVal%22%3A%22229694.0%22%2C%22agility%22%3A%2260794.0%22%2C%22teamSize%22%3A%22100%22%2C%22item1%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fapps%5C%2Fheros%5C%2Fassets%5C%2Fabilities%5C%2Fattack%5C%2Fanarchyseal.png%22%2C%22item2%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fapps%5C%2Fheros%5C%2Fassets%5C%2Fabilities%5C%2Fdefense%5C%2Fshadowgrave.png%22%2C%22item3%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fmovement%5C%2Fhaxxor.jpg%22%2C%22auras%22%3A%5B%7B%22name%22%3A%22Fury3%22%2C%22flash_url%22%3A%22aura_fury%22%2C%22layer%22%3A%220%22%7D%2C%7B%22id%22%3A%2263%22%2C%22category_id%22%3A%220%22%2C%22name%22%3A%22%22%2C%22magnitude_min%22%3A%220%22%2C%22magnitude_max%22%3A%221%22%2C%22flash_url%22%3A%22poison4%22%2C%22layer%22%3A%221%22%7D%5D%2C%22consumables%22%3A%5B%5D%7D%5D","background":"","user":0,"URL":"http:\/\/shcgame.klicknation.com\/apps\/heroes\/","muted":2,"song_muted":1,"debug":0,"plugin_prefix":"http:\/\/assets100.klicknation.com\/flash\/battle_system2\/plugins\/","theme_prefix":"http:\/\/assets100.klicknation.com\/flash\/battle_system2\/themes\/","avatar_url":"http:\/\/shcgame.klicknation.com\/apps\/heroes\/\/avatar_data.php?","animation_url":"http:\/\/shcgame.klicknation.com\/apps\/heroes\/\/battle_system\/battle_output_json.php","ui_prefix":"http:\/\/assets100.klicknation.com\/flash\/battle_system3\/ui\/components\/","aura_url":"http:\/\/assets100.klicknation.com\/flash\/animations\/aura\/","bg_prefix":"http:\/\/assets100.klicknation.com\/flash\/backgrounds\/"};
				
			var params = {"wmode": "transparent", "allowscriptaccess": "always"};

            if (!haveCorrectFlashVersion())
            {
                var c = document.getElementById('battlesystem_container');
                c.innerHTML = "<div id='box_content blue_content flight' style='font-size:16px;color:white;padding-top:50px;'>Your flash player is out of date.  <a href='[URL unfurl="true"]http://get.adobe.com/flashplayer/'[/URL] target='_blank'>You should update your flash player!</a></div>)";
            }
            else
            {
                swfobject.embedSWF("//assets100.klicknation.com/flash/battle_system3/battle_iframe_0019.swf", "battlesystem", "700", "460", "9.0.0", false, fvars, params, false, BSEmbedded);
            }
			
		</script>
	
			
	</body>
	
</html>
 
not tested.
Code:
[COLOR=#009900]$contents[/color] [COLOR=#990000]=[/color] [b][COLOR=#000000]file_get_contents[/color][/b][COLOR=#990000]([/color][COLOR=#FF0000]'[URL unfurl="true"]http://superherocity.klicknation.com/game/pages/battle_replay.php?battle=857337182'[/URL][/color][COLOR=#990000]);[/color] 
[COLOR=#009900]$pattern[/color] [COLOR=#990000]=[/color] [COLOR=#FF0000]'/var\s*fvars\s*=\s*(\{.*?\})/im'[/color][COLOR=#990000];[/color]
[b][COLOR=#000000]preg_match[/color][/b][COLOR=#990000]([/color][COLOR=#009900]$pattern[/color][COLOR=#990000],[/color] [COLOR=#009900]$contents[/color][COLOR=#990000],[/color] [COLOR=#009900]$match[/color][COLOR=#990000]);[/color]
[COLOR=#009900]$data[/color] [COLOR=#990000]=[/color] [b][COLOR=#000000]json_decode[/color][/b][COLOR=#990000]([/color][COLOR=#009900]$match[/color][COLOR=#990000][[/color][COLOR=#993399]1[/color][COLOR=#990000]]);[/color]
[b][COLOR=#0000FF]echo[/color][/b] [COLOR=#FF0000]'<pre>'[/color][COLOR=#990000];[/color]
[b][COLOR=#000000]print_r[/color][/b][COLOR=#990000]([/color][COLOR=#009900]$data[/color][COLOR=#990000]);[/color]
 
then the file_get_contents call is not bringing in the code properly.
try echo htmlspecialchars($contents); to verify what is being dragged in.

 
Ah - my bad! The replay URL actually has an iframe in it with the replay page and fvars variable. Once I changed the url in my php file to get the contents of that it output the below (still not recognizing some of the html characters I guess). This is excellent! I can start working on a form where the user will just supply the replay number and trying to massage that output into something intelligible for people to view.

Thank you very much!

Code:
stdClass Object
(
    [p1] => 383640
    [p2] => 2660363
    [rounds] => %5B%22528696%2C218209%2C299%2C0%2CDoomWhistle%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22572150%2C188349%2C303%2C0%2CSackAttack%2CAnarchy%2C0%2C0%2C%2C%2Cbeta%22%2C%22869089%2C291711%2C330%2C0%2CNightmareUltra%2CShadowAssault%2C0%2C0%2C%2C%2Cbeta%22%2C%22738726%2C254960%2C319%2C0%2CWipeoutFinal2%2CSoulReaper%2C0%2C0%2C%2C%2Cbeta%22%2C%22840120%2C202131%2C328%2C0%2CScatterDash%2CAnarchy%2C0%2C0%2C%2C%2Cbeta%22%2C%22637332%2C114847%2C309%2C0%2CStabbingTina%2CNightmare%2C0%2C0%2C%2C%2Cbeta%22%2C%22716999%2C135519%2C317%2C0%2CAttackoftheGreen%2CUndeadSummon%2C0%2C0%2C%2C%2Cbeta%22%2C%221042907%2C339947%2C346%2C0%2CBareKnuckleBrutality%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22934271%2C151598%2C336%2C0%2CSoulAbsorption%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%22506969%2C188349%2C297%2C0%2CHeatVision2%2CDemonSummon%2C0%2C0%2C%2C%2Cbeta%22%2C%22927029%2C135519%2C336%2C0%2CNeutronium%2CVisitorsAid%2C0%2C0%2C%2C%2Cbeta%22%2C%22927029%2C222803%2C336%2C0%2CRoboBaby%2CSoulReaper%2C0%2C0%2C%2C%2Cbeta%22%2C%22724241%2C257257%2C317%2C0%2CSteelShockwave%2CBigBangExtermination%2C0%2C0%2C%2C%2Cbeta%22%2C%22825635%2C339947%2C327%2C0%2CNightmareUltra%2CNovaBurst%2C0%2C0%2C%2C%2Cbeta%22%2C%7B%22name%22%3A%22%5Cu00e2%5Cu0097%5Cu0084PhX%5Cu00e2%5Cu0096%5Cu00ba+%7C-Final+Judgement-%7C%22%2C%22max_life%22%3A22644%2C%22level%22%3A%221564%22%2C%22attackVal%22%3A%22724241.1%22%2C%22agility%22%3A%22328363.1%22%2C%22teamSize%22%3A7820%2C%22item1%22%3A%22http%3A%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fattack%5C%2Fregression.jpg%22%2C%22item2%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fdefense%5C%2Ftow_7sins.jpg%22%2C%22item3%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fmovement%5C%2Fspring2012.jpg%22%2C%22auras%22%3A%5B%7B%22name%22%3A%22Protection2%22%2C%22flash_url%22%3A%22aura_protection%22%2C%22layer%22%3A%220%22%7D%2C%7B%22name%22%3A%22Fury3%22%2C%22flash_url%22%3A%22aura_fury%22%2C%22layer%22%3A%220%22%7D%2C%7B%22id%22%3A%221%22%2C%22category_id%22%3A%220%22%2C%22name%22%3A%22Test%22%2C%22magnitude_min%22%3A%221%22%2C%22magnitude_max%22%3A%2210%22%2C%22flash_url%22%3A%22testurl%22%2C%22layer%22%3A%222%22%7D%2C%7B%22id%22%3A%22319%22%2C%22category_id%22%3A%22319%22%2C%22name%22%3A%22mascot_wolfman%22%2C%22magnitude_min%22%3A%220%22%2C%22magnitude_max%22%3A%229000%22%2C%22flash_url%22%3A%22%22%2C%22layer%22%3A%221%22%7D%5D%2C%22consumables%22%3A%5B%5D%7D%2C%7B%22name%22%3A%22%26lt%3B7%26gt%3B+Lust%22%2C%22max_life%22%3A4241%2C%22level%22%3A%221000%22%2C%22attackVal%22%3A%22229694.0%22%2C%22agility%22%3A%2260794.0%22%2C%22teamSize%22%3A%22100%22%2C%22item1%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fapps%5C%2Fheros%5C%2Fassets%5C%2Fabilities%5C%2Fattack%5C%2Fanarchyseal.png%22%2C%22item2%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fapps%5C%2Fheros%5C%2Fassets%5C%2Fabilities%5C%2Fdefense%5C%2Fshadowgrave.png%22%2C%22item3%22%3A%22%5C%2F%5C%2Fassets100.klicknation.com%5C%2Fshc%5C%2Fabilities%5C%2Fmovement%5C%2Fhaxxor.jpg%22%2C%22auras%22%3A%5B%7B%22name%22%3A%22Fury3%22%2C%22flash_url%22%3A%22aura_fury%22%2C%22layer%22%3A%220%22%7D%2C%7B%22id%22%3A%2263%22%2C%22category_id%22%3A%220%22%2C%22name%22%3A%22%22%2C%22magnitude_min%22%3A%220%22%2C%22magnitude_max%22%3A%221%22%2C%22flash_url%22%3A%22poison4%22%2C%22layer%22%3A%221%22%7D%5D%2C%22consumables%22%3A%5B%5D%7D%5D
    [background] => 
    [user] => 0
    [URL] => [URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes/[/URL]
    [muted] => 2
    [song_muted] => 1
    [debug] => 0
    [plugin_prefix] => [URL unfurl="true"]http://assets100.klicknation.com/flash/battle_system2/plugins/[/URL]
    [theme_prefix] => [URL unfurl="true"]http://assets100.klicknation.com/flash/battle_system2/themes/[/URL]
    [avatar_url] => [URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes//avatar_data.php?[/URL]
    [animation_url] => [URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes//battle_system/battle_output_json.php[/URL]
    [ui_prefix] => [URL unfurl="true"]http://assets100.klicknation.com/flash/battle_system3/ui/components/[/URL]
    [aura_url] => [URL unfurl="true"]http://assets100.klicknation.com/flash/animations/aura/[/URL]
    [bg_prefix] => [URL unfurl="true"]http://assets100.klicknation.com/flash/backgrounds/[/URL]
)
 
They look recognised from here. The round item looks as though it might be urlencoded. So if you want to display it differently you will need to run it through urldecode. Or perhaps it is supposed to look like that.
 
If I want to put a form before the php page, how might I use the form ID as part of the URL on the php page? Below is a simple form page but, the inclusion of the form ID on the index.php page url breaks the output.

battle.html
Code:
<html>
<head>
<title>Battle!</title>
<base href="[URL unfurl="true"]http://www.cbsarge.com/">[/URL]
</head>
<body>
<table width="760" bgcolor="" background="" border="0" cellspacing="0" cellpadding="0" align="center">
<tr class=content> 
<td>
<table width="100%" class=border border="0" cellspacing="20" cellpadding="10">
<tr class=content> 
<td valign="top">
<br /><br />
<form name="frmSend"
          action="/index.php" 
          method="POST" 
          onsubmit = "return validateForm();">
<input type="hidden" name="Submission" value="yes">
<table border="0"  cellspacing="0" cellpadding="0" width="100%">
<tr><td><p><font color=#FFD927><b>BATTLE LINK</b></font></td>
<td width="75%"><h2><input tabindex="1" type="text" name="FJbattleID" value="" maxlength=25 size=25></h2></td>
</tr>
<tr><td><h2>&nbsp;</h2></td>
<td><h2 align="right"><u><input tabindex="6" style="margin-top:4" type="submit" value="Submit!" NAME="Submit1"></U></h2></td>
</tr>
</td></tr></table>
<br />
<br />
</form>
<p align=right><b><a href="[URL unfurl="true"]http://www.cbsarge.com/battle.html">Reset[/URL] Form</a></b></p>
</td></tr></table>
<br />
</table>	
</body>
</html>

NEW index.php
Code:
<?php 
$contents = file_get_contents('[URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes//pages/battle_iframe.php?battle='[/URL] + FJbattleID + '&kn_context=openweb'); 
$pattern = '/var\s*fvars\s*=\s*(\{.*?\})/im';
preg_match($pattern, $contents, $match);
$data = json_decode($match[1]);
echo '<pre>';
print_r($data);
 ?>
 
Data posted from an HTML form using the post method is available in the $_POST superglobal variable.
 
How would I pull the input from $_POST for use in the url?
 
This doesn't work :( but, something like this?

Code:
<?php 
var FJbattleID = $_POST['FJbattleID'];
$contents = file_get_contents('[URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes//pages/battle_iframe.php?battle=FJbattleID&kn_context=openweb');[/URL] 
$pattern = '/var\s*fvars\s*=\s*(\{.*?\})/im';
preg_match($pattern, $contents, $match);
$data = json_decode($match[1]);
echo '<pre>';
print_r($_POST['FJbattleID']);
echo '<br>';
print_r($data);
 ?>
 
Got it (I think). The below works. I'm not sure if it's the most efficient way to do it but, it works! :)

Code:
<?php 
$fjbattleid = $_POST['FJbattleID'];
$contents = file_get_contents('[URL unfurl="true"]http://shcgame.klicknation.com/apps/heroes//pages/battle_iframe.php?battle='.$_POST[/URL]['FJbattleID']); 
$pattern = '/var\s*fvars\s*=\s*(\{.*?\})/im';
preg_match($pattern, $contents, $match);
$data = json_decode($match[1]);
echo '<pre>';
print_r($_POST['FJbattleID']);
echo '<br>';
echo '<br>';
print_r($data);
?>
 
I'm guessing now that I'll have to do something with arrays in order to preform math on these stats. I switched to using urldecode in order to more cleanly (get rid of all the %xx stuff) interpret the grabbed content. One line of the output is all of the action that takes place in the battle. Below is one attack sequence. The first 2 numbers are the attack rolls of each player followed by the damage dealt by the attacker and defender then the names of the attacker and defender's attacks. I haven't determined what the next 0,0,,,beta means yet. I'm thinking in order to do math I'll have to grab every so many values based on where the commas are. Is something like this possible by creating another matching pattern like the one you used to grab the fvars data or can you somehow tell it to grab every 4th "value" using the comma as a delimiter?

Code:
"528696,218209,299,0,DoomWhistle,NovaBurst,0,0,,,beta"
 
much easier

Code:
$bits = explode(',', $string);
in this case you'd pass in that array value (NOT the array) as the $string argument.
the result is a numeric array.

you can also do this
Code:
list($a, $b, $c, $d, ...) = explode(',', $string);
this would then put each 'bit' in $a, $b etc.

 
so if the below output it what I'm dealing with how would I use this method to parse it out? It's a LOT to process!

Code:
["528696,218209,299,0,DoomWhistle,NovaBurst,0,0,,,beta","572150,188349,303,0,SackAttack,Anarchy,0,0,,,beta","869089,291711,330,0,NightmareUltra,ShadowAssault,0,0,,,beta","738726,254960,319,0,WipeoutFinal2,SoulReaper,0,0,,,beta","840120,202131,328,0,ScatterDash,Anarchy,0,0,,,beta","637332,114847,309,0,StabbingTina,Nightmare,0,0,,,beta","716999,135519,317,0,AttackoftheGreen,UndeadSummon,0,0,,,beta","1042907,339947,346,0,BareKnuckleBrutality,NovaBurst,0,0,,,beta","934271,151598,336,0,SoulAbsorption,NovaBurst,0,0,,,beta","506969,188349,297,0,HeatVision2,DemonSummon,0,0,,,beta","927029,135519,336,0,Neutronium,VisitorsAid,0,0,,,beta","927029,222803,336,0,RoboBaby,SoulReaper,0,0,,,beta","724241,257257,317,0,SteelShockwave,BigBangExtermination,0,0,,,beta","825635,339947,327,0,NightmareUltra,NovaBurst,0,0,,,beta",
 
use the first code snip.
assuming that the main array key is called 'mylongstring'
you would do this
Code:
$bits = explode(',',$data['mylongstring']);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top