Current location: Hot Scripts Forums » General Web Coding » Flash & ActionScript » How to execute php inside flash and display the result


How to execute php inside flash and display the result

Reply
  #1 (permalink)  
Old 02-28-07, 04:33 PM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Arrow How to execute php inside flash and display the result

Hi all. could any one tell me how i can execute a .php script inside a flash 8 and display its result. Now if i call my .php script it displays an image. So i want to do the same inside flash by calling this .php and display output image.Looking forward for step by step instruction since i am new to flash.Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-05-07, 07:05 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
take a look at LoadVars on adobe livedocs

also search the web for "flash php interaction tutorial", i'm pretty sure you'll come up with something.

UnrealEd
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-05-07, 09:21 PM
method method is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 228
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for your reply. I looked at some tutorials. But non of them show me step by step what to do as you know i am new to world of flash 8 . I do not want to spend many hours for this. All i want to do call the following php code :

PHP Code:

<?php

header
("Cache-Control: no-cache, must-revalidate");
    
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      
header ("Content-type: image/png");


$xml file_get_contents("http://www.somesite.com/feed.xml");

preg_match_all('/<(artist|song|image)>([^<]+)<\/\\1>/i'$xml$matches);

list(
$artist$song$imageurl) = $matches[2];

echo 
$image url;

?>
xml file:


xml Code:
  1. <playlist version="1" xmlns="http://xspf.org/ns/0/">   
  2. <trackList>       
  3.  <track>           
  4.  <title>Grass by Night</title>           
  5. <creator>Jeroen Wijering</creator>           
  6.  <location>image1.jpg</location>           
  7. <info>http://www.jeroenwijering.com</info>     
  8.   </track>     
  9.  
  10. </playlist>

and use imageurl and artist and song varibles and display them. Unfortunelty non of the tutorils show how to use php variables in flash and display them!! i be happy if some one show me how to do this step by step.

Last edited by UnrealEd; 03-07-07 at 06:21 AM. Reason: please you [php] and [highlight] when you post code
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-07-07, 06:42 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
here's an example on how to get the $imageurl into flash:
Actionscript Code:
  1. // create a new loadvars variable
  2. var lv:LoadVars = new LoadVars();
  3. // if you want to send a parameter together with the lodavars, you have to fill it in here:
  4. lv.my_param_name = my_param_value;
  5. /* now load the page:
  6. depending on what you want to do (just load, send data and load, only send data), you have three options:
  7. LoadVars.send : only sends data
  8. LoadVars.sendAndLoad : sends data and loads the results
  9. LoadVars.load : loads a php
  10. as you only load data from the page load() will suffise:*/
  11. lv.load("http://www.myurl.com/mypage.php");
  12. // now define what you want to do with the loaded data:
  13. lv.onLoad = function(){
  14.   // grab the imageurl
  15.   if(this.imageurl != ""){
  16.     // do stuff with the var
  17.   }else{
  18.     // something went wrong
  19.   }
  20. };
here's the php page, which is similar to the one you use:
PHP Code:

<?php

header
("Cache-Control: no-cache, must-revalidate");
    
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
      
header ("Content-type: image/png");


$xml file_get_contents("http://www.somesite.com/feed.xml");

preg_match_all('/<(artist|song|image)>([^<]+)<\/\\1>/i'$xml$matches);

list(
$artist$song$imageurl) = $matches[2];

echo 
"&imageurl=".$imageurl;

?>
Hope this helps you any further

UnrealEd
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone know how to incorporate PHP and MySQL in Flash? sondogg PHP 4 12-25-07 11:24 PM
PHP - detecting flash.. mcrob PHP 1 10-04-05 09:33 AM
Display Flash Movies in PHP bxcheats PHP 0 12-22-04 10:02 AM
Question about PHP and Flash krmoon PHP 1 09-19-04 10:16 PM
Using Flash to display users online... musiq The Lounge 2 08-15-04 02:59 AM


All times are GMT -5. The time now is 10:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.