简体   繁体   中英

XML from as2 to PHP

I am working on some old Flash as2 application that worked fine until something happened. Most likely it's Flash 13 upgrade but I can't figure out why. PHP version on server didn't changed.

I have following function in Flash that packs XML with another function and send to printcard.php:

var xmlDoc:Object=toXML();
xmlDoc.send(_global.phpPath + "printcard.php","_blank");

printcard.php should take $_POST XML and do some work with it ...

$data = GET_POST_XML();

$xml = new XML($data);

$arrCardPage = $xml->getBranches("card", "CardPage"); 

$cardPage = $arrCardPage[0];

And really ancient GET_POST_XML() function that worked fine until recently:

global $HTTP_POST_VARS, $HTTP_RAW_POST_DATA;

if( $HTTP_RAW_POST_DATA == null || !isset($HTTP_RAW_POST_DATA) ){
    $xmldoc = '';
    reset($HTTP_POST_VARS);

    while(list($k, $v) = each($HTTP_POST_VARS)) {
    $xmldoc.=$k.'='.$v;
    };

    $xmldoc = stripslashes($xmldoc);

    $xmldoc = str_replace('<?php xml_version', '<?php xml version', $xmldoc);

    return $xmldoc;

} else {
        return $HTTP_RAW_POST_DATA;
 };

Problem is that $data is empty - I have no XML.

On phpinfo I have:

_POST["<card_id"]:
\"0\" shared=\"0\" doubleside=\"1\" BgColorPicker=\"0\" bwColors=\"1\" showBg=\"1\" name=\"\"><CardPage h=\"17.99\" w=\"46.99\"><layerFront><CardLayer bg=\"16777215\" bgImageURL=\"\"><elements><OvalElement bgAlpha=\"100\" lineAlpha=\"100\" bgColor=\"16777215\" lineColor=\"0\" lineSize=\"0.35\" useFill=\"true\" useLine=\"true\" rotation=\"0\" h=\"7.76\" w=\"22.93\" y=\"4.58\" x=\"22.57\" /></elements></CardLayer></layerFront><layerBack><CardLayer bg=\"16777215\" bgImageURL=\"\"><elements /></CardLayer></layerBack></CardPage></card>

What did I missed?

use

$data = file_get_contents('php://input');

instead of

$data = GET_POST_XML();

OK, here's update in case someone stack with same issue:

Send command is deprecated from Flash version 13. It doesn't send RAW POST DATA anymore.

However, SendAndLoad still works fine.

Couldn't find anything on Google or official Adobe release notes about this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM