[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

swishmax 3 post to php

Posted on 2009-12-31
12
Medium Priority
?
682 Views
Last Modified: 2012-05-08
Okay, here's the drill.  I'm not a programmer, so take it easy on me.  I built a contact form using a program called swishmax 3 (flash) and one of their tutorials.  My problem is that when I hit my submit button to load my variable data to post to my php, everything works just fine.  The data loads correctly in my php and it generates my email.  All is good, except.....this only works when testing my file within the swishmax program.  As soon as I try and test it outside of the program, or if I upload the swf file to my site and run it from there, nothing gets sent to my php.  I've tried seeking help on their forum, but no luck.  I will post my scripting I use for my submit button and also my php script.  Any ideas at all why this will not work outside of the program?  Is there a particular html setting I'm supposed to use or a particular swf setting, or do you think it's something wrong with either script, etc.  Really hoping somebody out there uses swishmax 3.  I could then send you the swi file.  Help!!
my-php-script.txt
my-submit-button-script.txt
0
Comment
Question by:etdreaming
  • 7
  • 5
12 Comments
 
LVL 19

Expert Comment

by:moagrius
ID: 26154750
it should be fine - there are no settings you need to worry about.

my best guess is that it's a domain issue - i noticed the button uses and absolute path (http://whatever)

if that path doesn't match exactly the domain the swf is in, it might fail.  for example, if your target url is "http://www.mydomain.com/my-script.php" and you're loading the swiff at "http://mydomain.com" (notice the lack of "www"), it will fail.

my suggestion would be to use a relative path in your actionscript.  so where it says:

loadVariables("http://MySiteAndFileLocationGoesHere.php",'POST');

change that to:

loadVariables("your-php-file.php",'POST');

notice the lack of "http://" and everything else.

then make sure both the swf and the php file are in the same directory on the web server.

note that this will only work when uploaded to the web server, and will now fail when testing from within your application.

0
 

Author Comment

by:etdreaming
ID: 26155135
Yeah, one of my problems is that my site is hosted on a third party server that doesn't support php, so I had to have my php uploaded to my companies server, hence the reason for the exact path.  If I take my exact path and copy and paste that into my browser it generates my email, of course there's no variable data displayed, but at least I know that the path is correct.  I'm just at a complete loss as to why nothing happens once I launch the swf.
0
 

Author Comment

by:etdreaming
ID: 26155148
I just read your response a little closer.  You think since my swf and php are not on the same domain that would cause the problem, even if I had the exact path to my php correct?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 19

Expert Comment

by:moagrius
ID: 26155172
flash has security sandbox restrictions that prevent a swiff in one domain from accessing scripts in another domain.

if you have access to your company's server, you can use a crossdomain.xml policy file.  that file is saved on the root of the domain hosting the script to be accessed, and can be configured to allow another domain access to it's script.  it looks like the attached snippet.

more information about crossdomain policy files can be found here: http://kb2.adobe.com/cps/142/tn_14213.html

(or of course a quick google will yield tons of info and examples)
<?xml version="1.0"?>
	    <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
	    <cross-domain-policy>
	    <allow-access-from domain="www.the-site-without-php-support.com" />
	    </cross-domain-policy>

Open in new window

0
 
LVL 19

Expert Comment

by:moagrius
ID: 26155193
"I just read your response a little closer.  You think since my swf and php are not on the same domain that would cause the problem, even if I had the exact path to my php correct?"

yes.  : )

if you don't have access to the server hosting the script, normally a proxy file is used - but in your case, if the server the swiff is sitting on doesn't support php at all, you're kind of out of luck if you don't have access to the company server.

anyhow, hopefully you do have access and my post immediately before this one can solve your problem.
0
 

Author Comment

by:etdreaming
ID: 26155212
I'll get this to our i.t. guys and let you know.   Return shortly...
0
 

Author Comment

by:etdreaming
ID: 26155323
One other question.  The server my swf sets on does not support php, nor do I have access to it beyond where I upload files for my site, etc.  It's a third party hosting company similiar to godaddy.  However, I do have access to the server that my php file resides on.  It's a server that belongs to my employer.  If I have one of our i.t. guys place this crossdomain.xml policy file on there, you think that might solve my problem, correct?
0
 
LVL 19

Accepted Solution

by:
moagrius earned 2000 total points
ID: 26155369
yes.  it needs to be in the root directory of the server that has the php script (by root directory i mean, not in any particular subdirectory...  some servers have a strange set up so i'd just put one copy in all the spots you think might be the root directory then clean up later).  that file needs to allow the domain that has the swiff, on this line:

<allow-access-from domain="www.the-site-without-php-support.com" />

obviously, change "www.the-site-without-php-support.com" to the actual domain.

check the link i provided for more detailed instructions.
0
 

Author Comment

by:etdreaming
ID: 26155643
I may not get back with you until Monday.  Depends on if the i.t. department has time to get to this before then and of course tomorrow is a holiday, but I won't forget you.  This is pretty important to me.  thx.
0
 

Author Comment

by:etdreaming
ID: 26173583
Haven't forgotten you.  They're working on getting that file uploaded hopefully today.
0
 

Author Comment

by:etdreaming
ID: 26174623
Hey, that worked!!  Thanks much!
0
 
LVL 19

Expert Comment

by:moagrius
ID: 26174644
glad you got it working
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month17 days, 21 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question