I have a Flash app that I’m trying to hook up to my php script which will take the Flash values through the POST method. The php script will load two text files with data that goes before and after the Flash values, and then prints the result to a text file. Here is my php script and AS 2.0 for Flash 8.
submit_btn.onRelease = function( )
{
var myVars:LoadVars = new LoadVars();
myVars.resistor_val = res.text;
myVars.inductor_val = ind.text;
myVars.capacitor_val = cap.text;
myVars.sendAndLoad( "netlist.php", myVars, "POST" );
};
<?php
$resistorVal = $_POST['resistor_val'];
$inductorVal = $_POST['inductor_val'];
$capacitorVal = $_POST['capacitor_val'];
$prewrap = 'netlist_pre.txt';
$filename = 'netlist_example.txt';
$postwrap = 'netlist_post.txt';
$flashVar = "mycontent=";
$offsetVal = strlen( $flashVar );
$prefile = file_get_contents( $prewrap, FALSE, NULL, $offsetVal, filesize( $prewrap ) );
$postfile = file_get_contents( $postwrap, FALSE, NULL, $offsetVal, filesize( $postwrap ) );
$filedata = $resistorVal . "-" . $inductorVal . "-" . $capacitorVal;
$netlist = $prefile . " " . $filedata . " " . $postfile;
$write = file_put_contents( $filename, $netlist, LOCK_EX );
?>
I am having trouble getting the php script to write the file to the specified text name. No idea what is happening. :crying: Any help is greatly appreaciated. Thanks :pleased: