# \[Facebook\]How to pass data from php to flash?

**URL:** <https://forum.kirupa.com/t/facebook-how-to-pass-data-from-php-to-flash/310826>\
**Category:** flash\
**Created:** [June 20, 2010, 7:27pm UTC](https://forum.kirupa.com/t/facebook-how-to-pass-data-from-php-to-flash/310826 "2010-06-20T19:27:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erickk](https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/32.png) [@Erickk](https://forum.kirupa.com/u/Erickk)\
**Post date:** [June 20, 2010, 7:27pm UTC](https://forum.kirupa.com/t/facebook-how-to-pass-data-from-php-to-flash/310826/1 "2010-06-20T19:27:19Z")

</div>

Hi,  
I am not sure to post on this section or in PHP section.  
Anyway i am a beginner in PHP n Flash.  
My question is how to display Facebook logged in username and profile image into Flash by using Flashvar??  
Here is the php code please check whether it is correct or not?

```php

 <?php
//include facebook api etc.
require_once("facebook/facebook.php");

//create new facebook instance
$facebook = new Facebook('xxx', 'xxx');

//prompt the user to login
$fb_user = $facebook->require_login();

//check if the user has added the app
if (!$facebook->api_client->users_isAppUser()) {
          //if not, redirect him to add it
               $facebook->redirect($facebook->get_add_url());
}
//select the profile image
      $photoData = $facebook->api_client->users_getInfo($fb_user, 'pic_big'); 
       $photo = $photoData[0]['pic_big'];
//select the profile name
       $tmp=$facebook->api_client->fql_query("SELECT name FROM user WHERE uid=$user");
      $nam=$tmp[0]["name"];

?>
       <!-- flash file -->
      <fb:swf swfsrc='http://xxx/app/fbtest.swf' allowscriptaccess='never' bgcolor='#ffffff' wmode='transparent' flashvars='u_img=<?php echo urlencode($photo);?>& u_name=<?php echo urlencode($nam);?>' width='500' height='400'/>

```

And for the Flash part i do not know how to write the code into it.  
The component i will be using is UILoader for the Image and Textfield for name.  
Please kindly help me out.  
Thankyou.
