# Sending data between Flash and PHP

**URL:** <https://forum.kirupa.com/t/sending-data-between-flash-and-php/282610>\
**Category:** flash\
**Created:** [February 24, 2009, 7:42am UTC](https://forum.kirupa.com/t/sending-data-between-flash-and-php/282610 "2009-02-24T07:42:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lesnaubr](https://avatars.discourse-cdn.com/v4/letter/l/c0e974/32.png) [@lesnaubr](https://forum.kirupa.com/u/lesnaubr)\
**Post date:** [February 24, 2009, 7:42am UTC](https://forum.kirupa.com/t/sending-data-between-flash-and-php/282610/1 "2009-02-24T07:42:37Z")

</div>

I have a high score system in one of my Flash games. I send text to a PHP file which writes the information to a text file. I had it all working over a year ago but now it has seemed to stop working.

My AS 2.0 Code:

[AS]  
System.security.loadPolicyFile(“[http://www.myurl.com/crossdomain.xml](http://www.myurl.com/crossdomain.xml)”);

sv = new LoadVars();  
sv.sendText = “string to send”;  
trace(sv.sendText);  
sv.sendAndLoad(“[http://www.myurl.com/writeall.php](http://www.myurl.com/writeall.php)”, sv, “POST”);  
[/AS]

My writeall.php code:

```php

<?php
$text = $_POST[sendText];
$myfile = fopen("puzzleall.txt","a");
$fp = fwrite($myfile,$text);
$fp = fwrite($myfile,chr(13));
fclose($myfile);
print "&response=".$text;
?>

```

No errors or anything come up and like I said, this was all working before. Any ideas?
