# Flash/PHP

**URL:** https://forum.kirupa.com/t/flash-php/218425
**Category:** Uncategorized
**Created:** [March 7, 2007, 5:16pm UTC](https://forum.kirupa.com/t/flash-php/218425 "2007-03-07T17:16:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cki](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@cki](https://forum.kirupa.com/u/cki)
#### Post date: [March 7, 2007, 5:16pm UTC](https://forum.kirupa.com/t/flash-php/218425/1 "2007-03-07T17:16:59Z")

</div>

Using PHP as middleware, the following is displayed in the browser:

> 

&thePrices=partCD+Player&thePrices=price320&thePrices=partShocks&thePrices=price450&thePrices=partCar+Cover&thePrices=price500

This appears in the output window in FLASH:

> 

price500

What changes need to be made to the PHP/AS.

```auto

<?xml version="1.0" encoding="ISO-8859-1"?>
<priceList>
	<part id="001-A">CD Player</part>
	<price>320</price>
	<part id="002-A">Shocks</part>
	<price>450</price>
	<part id="003-A">Car Cover</part>
	<price>500</price>
</priceList>

```

```auto

<?php
//Create path to document
$doc="./priceList.xml";
global $thePrices;
//load document.
$xml=simplexml_load_file($doc);
//echo $xml->asXML() . '<br />';
//loopthrough names and prices.
//echo $xml->getName() . '<br />';
foreach ($xml->children() as $child){
	echo $child->getName(). ": " . $child . '<br />';
	$thePrices.= "&thePrices=".	(urlencode($child->getName() . $child));
	}

echo $thePrices;
/*
$thePrices .= (urlencode($child->getName() . $child));
'thePrices'=$thePrices;
*/

?>

```

```auto

//Create the LoadVars instance to retrieve the prices from the PHP script.
var getPrices:LoadVars=new LoadVars();
//load prices from PHP.
getPrices.load("http://localhost/~username/folderpath/autoPrices/pricesFlash.php?ck=" + new Date().getTime());
//
getPrices.onLoad=function(){
	trace(this.thePrices);
	
	
}

```
