More of a PHP question than a Flash question. But I attached code I have used
with PHP 4.3 +
Also you may want the Flash movie to know if the PHP script succeeded and thus
you will want http://livedocs.macromedia.com/flash/8/main/00002879.html.
A full example is located at
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHP/EX01/XMLPHP
EchoEx01_Doc.php.
<?php
header('content-type: application/xml; charset="iso-8859-1"');
/*----------------------------------------------------------------------
Lon Hosford: http://www.lonhosford.com
Purpose: Simple example Flash XML to PHP and Back
Version history:
Number: 1.00.00
Date: 9/15/2005
File name: XMLPHPEchoEx01_Response.php
Programmer: Lon Hosford: http://www.lonhosford.com
Changes: Original programming
------------------------------------------------------------------------
Get data from PHP. Requires PHP 4.3 or greater.
---------------------------------------------------------------------*/
$xmlRequest = file_get_contents("php://input");
/*----------------------------------------------------------------------
Optional dump to server side text file. Reminder your
server folder needs to allow write and create permission
for the file name selected.
------------------------------------------------------------------------
File name to dump data from Flash
---------------------------------------------------------------------*/
$filename = "xmloutput.txt";
/*----------------------------------------------------------------------
Open stream to file
---------------------------------------------------------------------*/
$fp = fopen( $filename,"w+");
/*----------------------------------------------------------------------
Write to stream
------------------------------------------------------------------------
Any text into file for testing in case nothing is received
---------------------------------------------------------------------*/
fwrite ( $fp, "Test" );
/*----------------------------------------------------------------------
Data from Flash
---------------------------------------------------------------------*/
fwrite ( $fp, $xmlRequest );
/*----------------------------------------------------------------------
Close stream
---------------------------------------------------------------------*/
fclose( $fp );
/*----------------------------------------------------------------------
Echo data back to Flash
------------------------------------------------------------------------
Create xml header to exh-
---------------------------------------------------------------------*/
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
/*----------------------------------------------------------------------
Data received
---------------------------------------------------------------------*/
echo $xmlRequest ;
?>
cosu - 18 Apr 2007 10:45 GMT
thank you. the php code seems ok. it was the [b]$xmlRequest = file_get_contents("php://input");[/b] i didn't know.