Показать сообщение отдельно
Старый 03.07.2008, 00:06
Leonik вне форума Посмотреть профиль Отправить личное сообщение для Leonik Найти все сообщения от Leonik
  № 7  
Ответить с цитированием
Leonik

Регистрация: Jun 2008
Сообщений: 34
Цитата:
Сообщение от Alex Lexcuk Посмотреть сообщение
http://www.flasher.ru/forum/showthread.php?t=113083

Какие ошибки вы там нашли?
спасибо! причину я нашел...
вобщем дело в сервере (PHP) при посылке XML на сервер, сам сервер его получает в RAW сыром веди как я понял, вытаскиваются все данные в виде $GLOBALS["HTTP_RAW_POST_DATA"] а не в $_POST как я думал...

вот пример нашёл:

AS3
Код:
// Generate a random score to save with the username
      var score:int = Math.floor( Math.random(  ) * 10 );
      
      // Create a new XML instance containing the data to be saved
      var dataToSave:XML = <gamescore>
                             <username>{_username.text}</username>
                             <score>{score}</score>
                           </gamescore>;
      
      // Point the request to the script that will handle the XML
      var request:URLRequest = new URLRequest( "http://www.sd-ii.fr/gamescores.php" );
      // Set the data property to the dataToSave XML instance to send the XML
      // data to the server
      request.data = dataToSave;
      //request.data = variables;
      // Set the contentType to signal XML data being sent
      request.contentType = "text/xml";
      // Use the post method to send the data
      request.method = URLRequestMethod.POST;
      
      // Create a URLLoader to handle sending and loading of the XML data
      var loader:URLLoader = new URLLoader(  );
      // When the server response is finished downloading, invoke handleResponse
      loader.addEventListener( Event.COMPLETE, handleResponse );
      // Finally, send off the XML data to the URL
      loader.load( request );

PHP
Код:
// Read In XML from Raw Post Data.
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
     
// Process XML using DOM PHP extension.
$document = xmldoc($xml);
     
// Read root element <gameinfo>.
$rootElement = $document->root(  );
     
// Read child nodes <username> and <score>.
$childNodes = $rootElement->children(  );
     
$data = "";
     
// Loop through child nodes and place in array.
foreach($childNodes as $childNode){
  // Add data to array;
  $name = $childNode->tagName(  );
  $value = $childNode->get_content(  );
  $data[$name] = $value;
}
     
// Append data to scores.txt ( format: username|score )
$fp = fopen("scores.txt","a+");
$dataString = $data['username'] . "|" . $data['score'] . "\n";
fwrite($fp,$dataString,strlen($dataString));
fclose($fp);
     
// Return success code to Flash
echo "<success>1</success>";
ссылка http://www.actionscript.org/forums/s....php3?t=169554

также можно к ссылке запроса добавлять время что бы обойти хеширование (тут я ещё не до конца допёр как имео хеширование происходит)

можно даже тему перекинуть на серверные технологии
__________________
miada.ru