Accessing passed arguments from php script?
I have a php script which will pass an argument which I need
to turn in to a coldfusion variable, how should I go about doing
this?
I am developing a cf application to interface with the PLESK
control panel's Event manager to dynamically setup cf security
sandboxes when a new domain is added to PLESK. Plesk uses encrypted
php3 files and with the use of the event manager API I can pass the
new domain name to any script. However, I cannot alter the way
PLESK sends the param <new domain> therefore a cfhttp post is
impossible. All I can do is path the new domain as an argument to
the file IE: myscript.cfm.
I have tested passing the new domain to a bash shell script
and then using bash to drop the new domain name into a database
then using CURL to execute the .cfm file which sets up the new
sandbox. This is tested and working on Linux servers but now my
task is to do the same for Windows servers, hence I would prefer to
keep all the coding under cf
Similar Messages
-
Passing arguments from Air to Photoshop jsx script
I would like to invoke JavaScript file in Photoshop from my Adobe Air application. I managed to call my script with the following code:
// Create native startup info
nativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = filePhotoshop; // File referencing Photoshop exe
// Create Vector array to pass arguments
procarg = new Vector.<String>();
procarg.push("start");
procarg.push(jsFileToCall);// String with path to my jsx file
procarg.push(scriptData); // String with argument to pass to jsx file
nativeProcessStartupInfo.arguments = procarg;
// Create native process object for calling executable file
process = new NativeProcess();
// SET ERROR HANDLERS
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR ,onError,false,0,true);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
// CALL NATIVE PROCESS
process.start(nativeProcessStartupInfo);
The Photoshop app is started, my JavaScript is invoked, but the argument is not passed into jsx.
Is there any method how to pass arguments to script in Photoshop? (I know that I can use the file to pass the parameters, but I do not like that solution.)
Thanks in advance for any hint.
Zdenek MThe only documented way I know of is programming the script as a Photoshop Plug-in that has a dialog. Then record using the script in an action. The script will record the arguments used in its dialog into the Photoshop Actions step. Then when the action is used played the action recorded arguments are retrived and the script bypasses displaying its dialog.
However In CS3 I looked at Adobe Photoshop Image Processor JavaScript it internaly used the Fit Image Plug-in Script and passed the width and hight to it. So it is posible to pass arguments from one JSX to an JSX Plug-in Script.
From CS5 "Image Processor.jsx"
// use the fit image automation plug-in to do this work for me
function FitImage( inWidth, inHeight ) {
if ( inWidth == undefined || inHeight == undefined ) {
alert( strWidthAndHeight );
return;
var desc = new ActionDescriptor();
var unitPixels = charIDToTypeID( '#Pxl' );
desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
executeAction( runtimeEventID, desc, DialogModes.NO );
If You can write a file from Adobe Air you could also write the jsx file to pass the args you want to pass a to plug-in script via the ActionManager. -
Passing parameters from shell script to OWB process flow
Hi all,
I am running OWB process flow (using the template script provided by oracle) and i want to pass two date parameters as shown below:
sqlplus -s $SQL_USER/$SQL_PWD@$ORACLE_SID @$HOME_DIR/src/vmc_oem_exec_script.sql OWB_OWNER VMC_POST_DW_PF_LOC_SIT PROCESS VMC_NM1_PORT_MAIN "," "P_DATE_FROM=$DATE_FROM,P_DATE_TO=$DATE_TO"
How do i catch those values in process flow and pass those to mappings in Process flow?
Do i need to create PF variables with same names or any name will do?
Thanks in advanceThis document is explaining how to pass data between activities in process flow.
I am passing parameters from a shell script.
Any ideas,how to pass parameters from shell script and then initialize the process flow variables based on those values and then pass them further to mappings.
Thanks -
How to execute adobe air app & pass argument from Flex ?
Helo everyone,
May i ask a question, How to execute adobe air app & pass argument from Flex ?
Thanks in advanced.
Jacky Ho.Hello Jacky,
You can find an example here
http://spreadingfunkyness.com/passing-parameters-to-adobe-air-at-startup/ -
How to pass arguments from PAPI to the process
Can any one tell me How to pass arguments from PAPI to the process.
The link Creating a new work item instance in a process using PAPI shows how to create instances on PAPI and pass in the variable information as they are being created.
Provide some additional detail if you're interested in seeing how to pass in variable information using PAPI for scenarios other than instance creation.
Dan -
Dynamic xml from php script throws error: #1088 or #1085
Hi,
I'm importing xml formatted data from mysql via php script:
[code]
<?php
require_once('require.php');
$result = mysql_query("SELECT * FROM `songs`");
if($result)
header ("Content-Type: text/xml");
echo"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
echo"<songComments>\n";
while ($row = mysql_fetch_array($result))
echo"<testimonial>\n";
echo"<songComment>" . $row['title'] . "</songComment>\n";
echo"</testimonial>\n";
echo"</songComments>\n";
?>
[/code]
In one of my flash projects it's working just fine. But in the new one that I just sterted not anymore. And i have no idea why. I get this errors:
TypeError: Error #1085: The element type "songComments\n" must be terminated by the matching end-tag "</songComments\n>".
or:
TypeError: Error #1088: The markup in the document following the root element must be well-formed.
When I output that php into txt file and loaded in flash everything is fine, but not from php script directly.
Could it have something to do with that I'm testing that mysql locally on my computer using WAMP ? Previous project got all data from mysql from server.Ho could I trace what flash sees?
var url:URLLoader = new URLLoader();
url.addEventListener(Event.COMPLETE, xmlLoaded);
url.load(new URLRequest("getDataFromDB.php"));
private function xmlLoaded(event:Event):void {
myXML = new XML(event.target.data);
trace(myXML);
I got rid of that \n everywhere or move them around and it's still the same error 1088 or 1085 -
Passing variables from PHP to Flash
I have a contact form that works. The user enters their info,
hits submit, and their info is emailed to me. I need to figure out
how to have the PHP script send back a confirmation that the email
was actually sent. I can't get the php to echo just a "yes" or
"no". Here is what I have so far:
Flash code to bring in PHP variable to notify user if mail
has been sent or not:
function receive_response(e:Event):void
var loader:URLLoader = URLLoader(e.target);
var email_status = new URLVariables(loader.data).success;
if(email_status == "yes")
status_txt.text = "Success! Your message was sent.";
timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER, on_timer);
timer.start();
else
status_txt.text = "Send failed! Please email or call us";
and here is my entire PHP Code. The code in bold at the bottom
is where it is supposed to pass the "yes" or "no" as the variable
success
<<meta http-equiv="content-type"
content="text/html;charset=utf-8">
<?php
// Create local PHP variables from the info the user gave in
the Flash form
$senderName = $_POST['userName'];
$senderEmail = $_POST['userEmail'];
$senderMessage = $_POST['userMsg'];
// Strip slashes on the Local variables
$senderName = stripslashes($senderName);
$senderEmail = stripslashes($senderEmail);
$senderMessage = stripslashes($senderMessage);
$to = "info@*******.com";
// change this to reflect your site
$from = "contact@*********.com";
$subject = "Contact from ***********.com";
//Begin HTML Email Message
$message = <<<EOF
<html>
<body bgcolor="#FFFFFF">
<b>Name</b> = $senderName<br /><br />
<b>Email</b> = <a
href="mailto:$senderEmail">$senderEmail</a><br
/><br />
<b>Message</b> = $senderMessage<br />
</body>
</html>
EOF;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to";
if (mail($to, $subject, $message, $headers))
echo “success=yes”;
else
echo “success=no”;
exit();
?>
ThanksI have a contact form that works. The user enters their info,
hits submit, and their info is emailed to me. I need to figure out
how to have the PHP script send back a confirmation that the email
was actually sent. I can't get the php to echo just a "yes" or
"no". Here is what I have so far:
Flash code to bring in PHP variable to notify user if mail
has been sent or not:
function receive_response(e:Event):void
var loader:URLLoader = URLLoader(e.target);
var email_status = new URLVariables(loader.data).success;
if(email_status == "yes")
status_txt.text = "Success! Your message was sent.";
timer = new Timer(500);
timer.addEventListener(TimerEvent.TIMER, on_timer);
timer.start();
else
status_txt.text = "Send failed! Please email or call us";
and here is my entire PHP Code. The code in bold at the bottom
is where it is supposed to pass the "yes" or "no" as the variable
success
<<meta http-equiv="content-type"
content="text/html;charset=utf-8">
<?php
// Create local PHP variables from the info the user gave in
the Flash form
$senderName = $_POST['userName'];
$senderEmail = $_POST['userEmail'];
$senderMessage = $_POST['userMsg'];
// Strip slashes on the Local variables
$senderName = stripslashes($senderName);
$senderEmail = stripslashes($senderEmail);
$senderMessage = stripslashes($senderMessage);
$to = "info@*******.com";
// change this to reflect your site
$from = "contact@*********.com";
$subject = "Contact from ***********.com";
//Begin HTML Email Message
$message = <<<EOF
<html>
<body bgcolor="#FFFFFF">
<b>Name</b> = $senderName<br /><br />
<b>Email</b> = <a
href="mailto:$senderEmail">$senderEmail</a><br
/><br />
<b>Message</b> = $senderMessage<br />
</body>
</html>
EOF;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to";
if (mail($to, $subject, $message, $headers))
echo “success=yes”;
else
echo “success=no”;
exit();
?>
Thanks -
Passing Variables From PHP to Java Applet ?
I took one page of a project which was written entirely in PHP, and translated it into a JAVA applet, so as to support better GUI funcitonalities (immediate calculation and display of Time/Billing data, on LostFocus events...stuff like this).
In any case - I need to pass four variables from the php scripts, to the Java Applet. I had initially, written them out from the php scripts to an html file on the server, and read them in from the applet doing something like this:
. this.m_TheURL = new URL(url);
InputStream in = m_TheURL.openStream();
DataInputStream data = new DataInputStream(new BufferedInputStream(in));
while ((unparsed = data.readLine()) != null)
// parsed the strings here and got my variables
The URL I read from, was the same file I wrote out to from the PHP scripts. This worked fine - until I told my boss about it, and realised that this wasnt going to work - because the applet updates a MySql database, and issues regarding multiple users became apparent.
The Applet has to get these variables from the previous PHP page, the same way it had - before my applet was an applet, and it was just another PHP script page.
The PHP pages are passing variabes using CGI, and a PostGet function. My applet has to do the same thing.
Anybody know how I can do this - safely ?Updated some code... in case people wanted to use it....
<?php
class JavaApplet {
var $param;
function setParam($name, $value) {
$temp1 = array("name" => $name, "value" => $value);
$this->param = array_merge($this->param, $temp1);
function delParam($name) {
foreach ($this->param as $key => $value) {
if ($key = $name) {
unset( $this->param["$id"]);
function echo_html() {
echo '<applet code=TimeEntry.class width=600 height=90 >';
foreach ($this->param as $value) {
foreach ($value as $key => $value2) {
echo '<param name="' . $key . '" value="' . $value2 . '">';
echo '</applet>';
$applet = &New JavaApplet;
$applet->setParam("name1", "value");
$applet->setParam("name2", "value");
$applet->setParam("name3", "value");
$applet->echo_html();
?> -
Passing variables from PHP to AS3
I am trying to get variables retrieved from a MySQL database
by a PHP script into my ActionScript 3.0. script. To test I have
created a simple instance of dynamic text called date_txt, and put
the AS3 code below into the actions layer:
All I want to do now is replace the hardcoded date values
with variables passed from the PHP script (also shown below).
Can anyone suggest a VERY simple way of passing the PHP
variables $tgt_year, $tgt_month and $tgt_day into the AS3 code and
let me know what modifications I need to make to the PHP to make
the variables available to Flash?
Thanks, WillHi dzedward,
I tried the code you posted at
http://forums.flashgods.org/viewtopic.php?f=41&t=98
with a little problem. Why is it that the value from event.data
after complete loading has the value of the entire script of PHP
script?
At first, I have this error:
The markup in the document following the root element must be
well-formed.
I replace the following codes: ########
XML.ignoreWhitespace = true;
var theResult:XML = new XML(event.target.data);
var lastName = theResult.client.lname;
With this one: ########
trace(event.target.data);
and has this output: #########
<?Php
echo "<?xml version=\"1.0\"?><clients>";
echo "<client><lname>test
sdfsaf</lname></client>"
echo "</clients>";
?>
instead of this output: #########
<client><lname>test
sdfsaf</lname></client>
Please help me out.
Thank you -
Passing variable to PHP script
Hi,
I'm new to Oracle&APEX...
I would like to upload a file to server filesystem, but I could not fid a way this to be done via APEX?
(I somebody can give me a solution You are welcome)
I know how this could be done in PHP so I created a script, but I need then to confirm to the database that the file is uploaded. To do this I need to have variable transferred to my PHP script.
I've tried to build a button to pass the value with ?var=:P5_value, but only "P%_value" is passed as text not the value of this variable.
How this can be done?
Any suggestions?Hello,
You should use the webdav functionality in XE.
http://daust.blogspot.com/2006/03/where-are-images-of-application.html
then you get the best of both worlds you get files in the database but they can be accessed as if they are in the filesystem.
Note: APEX need to be replaced with HTMLDB for Oracle XEI have no idea what you are saying here, HTMLDB and APEX are the same thing.
Carl -
Passing variables from shell script to separate sqlplus script
Hi, I am having issues passing variables to a separate sqlplus script invoked by the shell script, e.g.
#!/bin/sh
DB_NAME=TEST
PWD1=PA55W0rd
echo exit | sqlplus / as sysdba @${DB_NAME}.sql ${DB_NAME} $PWD1 >> ${DB_NAME}.sql
exit 0
The script picks up the $DB_NAME variable fine, and therefore invokes the required sql script.
However, when I pass the variable $PWD1 to the sql script I get an error.
The script creates a database link:
create or replace procedure new.link
is
begin
execute immediate 'create database link TEST
connect to TESTSCH identified by '$PWD1'
using ''TEST''';
end;
exec new.link;
output is:
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at "NEW.LINK", line 4
ORA-06512: at line 1
any help appreciated!
Edited by: 969765 on Apr 5, 2013 4:24 AM969765 wrote:
that is a pretty unhelpful comment, this is actually my LAST resort I have looked up all the documentation etc.This is what I did...
I went to the documentation:
http://www.oracle.com/pls/db112/homepage
I searched for "sqlplus" which gave me this documentation (under "SQL*plus program syntax")...
http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_three.htm#i1169374
I read the syntax:
SQLPLUS [ [Options] [Logon|/NOLOG] [Start] ]and the subsequent information:
>
where Start has the following syntax:
@{url|file_name[.ext]} [arg ...]and "Start" was hyperlinked, so I clicked on it, which took me to the section...
>
Start
@} [arg ...]
Specifies the name of a script and arguments to run. The script can be called from the local file system or from a web server.
SQL*Plus passes the arguments to the script as if executing the file using the SQL*Plus START command. If no file suffix (file extension) is specified, the suffix defined by the SET SUFFIX command is used. The default suffix is .sql.
See the START command for more information.
>
and here the "START" was hyperlinked, so I clicked on that...
and hey presto, I ended up here:
http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve044.htm#BACJJHDA
... where the arguments are described...
>
arg ...
Data items you wish to pass to parameters in the script. If you enter one or more arguments, SQL*Plus substitutes the values into the parameters (&1, &2, and so forth) in the script. The first argument replaces each occurrence of &1, the second replaces each occurrence of &2, and so on.
>
... clearly explaining that SQL*Plus substitutes the substitution variables &1, &2 etc. in the script with the passed in arguments.
Your script was including a Unix style substitution, not an SQL*Plus script substitution, so that's seems to be the most likely cause of your problem.
And still you haven't come back to say whether it's worked for you or not... leaving others guessing as to whether you still need help. -
Calling stored procedure from php script.
I have the following stored procedure in Oracle 8:
CREATE OR REPLACE procedure kunde_create
(iname1 in varchar2,
iname2 in varchar2,
iname3 in varchar2,
ianrede in number,
istrasse in varchar2,
iland varchar2,
iplz in varchar2,
iort in varchar2,
iortsteil in varchar2,
itelefon in varchar2,
iemail in varchar2,
itelefax in varchar2,
imobil in varchar2,
ianrufer in varchar2,
izusinfo in varchar2,
izusatz2 in varchar2,
okdnr out varchar2)
is
vkndnr number;
vadrnr number;
vkdnr varchar2(15);
ikugru constant number:=4;
minkdnr constant varchar2(15):='44000000';
maxkdnr constant varchar2(15):='50000000';
begin
..... SOME CODE ....
okdnr:='something_to_output';
commit;
end kunde_create;
I am trying to call this SP from a php script, in this way:
$connection = ora_logon("username@db", "password");
$cursor = ora_open($connection);
ora_commitoff($connection);
$cu=ora_parse($cursor, "begin KW.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
ora_bind($cursor, ":Sta_nameD", $Sta_nameD, 32, 1);
ora_bind($cursor, ":Sta_name2D", $Sta_name2D, 32, 1);
ora_bind($cursor, ":ianredeD", $ianredeD, 32, 1);
ora_bind($cursor, ":Sta_straD", $Sta_straD, 32, 1);
ora_bind($cursor, ":Sta_landD", $Sta_landD, 32, 1);
ora_bind($cursor, ":Sta_plzD", $Sta_plzD, 32, 1);
ora_bind($cursor, ":Sta_ortD", $Sta_ortD, 32, 1);
ora_bind($cursor, ":Sta_ortsteilD", $Sta_ortsteilD, 32, 1);
ora_bind($cursor, ":Sta_telD", $Sta_telD, 32, 1);
ora_bind($cursor, ":Sta_mailD", $Sta_mailD, 32, 1);
ora_bind($cursor, ":Sta_faxD", $Sta_faxD, 32, 1);
ora_bind($cursor, ":Sta_tel2D", $Sta_tel2D, 32, 1);
ora_bind($cursor, ":Sta_anruD", $Sta_anruD, 32, 1);
ora_bind($cursor, ":Sta_zusD", $Sta_zusD, 32, 1);
ora_bind($cursor, ":Sta_zus2D", $Sta_zus2D, 32, 1);
ora_bind($cursor, ":okdnr", $okdnr, 32, 2);
ora_exec($cursor); //Line 93
This code brings me back this error:
Warning: Can't find variable for parameter in /www/vaillant/htdocs/www_tisweb/html/php/testdb/connect.php on line 93
I tried nearlly everything, but it doesnt work :(
Can anybody help me please.
Thanx in advance,
Ahmed AdailehI had to make a few modifications to get your example to work. The
biggest change was to the ora_bind syntax. I also found I had to
define a variable to hold the OUT value before doing the ora_exec.
Otherwise I got the error you saw. I'm not sure why defining it first
is necessary. I didn't dig deeply into PHP's oracle.c code.
My final script is below. It displays "okdnr is something_to_output".
I tested using PHP 4.3.3 against Oracle 9.2.
The best general suggestion I can make is to use PHP's oci8 driver
unless you need to be compatible with existing PHP code. There is an
example of using OUT binds in oci8 to call a stored procedure at
PHP and serveroutput
-- CJ
<?php
// Changed connection details to suit my environment
$connection = ora_logon("scott@MYDB", "tiger");
$cursor = ora_open($connection);
ora_commitoff($connection);
// Changed schema to SCOTT to match who I'd created the procedure as
$cu=ora_parse($cursor, "begin SCOTT.kunde_create ( :Sta_nameD, :Sta_name2D, :Sta_kugruD, :ianredeD, :Sta_straD, :Sta_landD, :Sta_plzD, :Sta_ortD, :Sta_ortsteilD, :Sta_telD, :Sta_mailD, :Sta_faxD, :Sta_tel2D, :Sta_anruD, :Sta_zusD, :Sta_zus2D ,:okdnr); end;");
// Allocated the IN parameter variables
$Sta_nameD = 'a';
$Sta_name2D = 'a';
$ianredeD = 1;
$Sta_straD = 'a';
$Sta_landD = 'a';
$Sta_plzD = 'a';
$Sta_ortD = 'a';
$Sta_ortsteilD = 'a';
$Sta_telD = 'a';
$Sta_mailD = 'a';
$Sta_faxD = 'a';
$Sta_tel2D = 'a';
$Sta_anruD = 'a';
$Sta_zusD = 'a';
$Sta_zus2D = 'a';
$Sta_kugruD = 'a';
// Changed ora_bind syntax to match
// http://www.php.net/manual/en/function.ora-bind.php
ora_bind($cursor, "Sta_nameD", ":Sta_nameD", 32, 1);
ora_bind($cursor, "Sta_name2D", ":Sta_name2D", 32, 1);
// Change ianredeD type to 2 to match procedure definition
ora_bind($cursor, "ianredeD", ":ianredeD", 32, 2);
ora_bind($cursor, "Sta_straD", ":Sta_straD", 32, 1);
ora_bind($cursor, "Sta_landD", ":Sta_landD", 32, 1);
ora_bind($cursor, "Sta_plzD", ":Sta_plzD", 32, 1);
ora_bind($cursor, "Sta_ortD", ":Sta_ortD", 32, 1);
ora_bind($cursor, "Sta_ortsteilD", ":Sta_ortsteilD", 32, 1);
ora_bind($cursor, "Sta_telD", ":Sta_telD", 32, 1);
ora_bind($cursor, "Sta_mailD", ":Sta_mailD", 32, 1);
ora_bind($cursor, "Sta_faxD", ":Sta_faxD", 32, 1);
ora_bind($cursor, "Sta_tel2D", ":Sta_tel2D", 32, 1);
ora_bind($cursor, "Sta_anruD", ":Sta_anruD", 32, 1);
ora_bind($cursor, "Sta_zusD", ":Sta_zusD", 32, 1);
ora_bind($cursor, "Sta_zus2D", ":Sta_zus2D", 32, 1);
// Changed okdnr type to 1 to match procedure definition
ora_bind($cursor, "okdnr", ":okdnr", 32, 1);
// Bound missing parameter
ora_bind($cursor, "Sta_kugruD", ":Sta_kugruD", 32, 1);
// Preallocated the output variable - I'm not sure why this is
// necessary nor what size is needed.
// When this line is commented out I get:
// Warning: Can't find variable for parameter in test01.php on line XX
$okdnr = "a";
ora_exec($cursor);
print "okdnr is $okdnr";
?> -
Cannot pass variables from PHP to actionscript 3.0
I am using CS3 and I write the following code as to pass variable to flash from PHP
Actionscript
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.TEXT;
var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
myLoader.load(myRequest);
myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
var myValue: String;
function onCompleteHandler(e:Event):void{
var myvariable: URLVariables = new URLVariables(e.target.data);
myValue = myvariable.values;
trace(myValue);
PHP file
<?php
echo ('values = 8');
?>
But I always get the error and cannot get the values by using trace();
Before i try to use "myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;" I still get the same error.
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Can anyone help me?The error is fixed.The new version is like that
Actionscript
var myLoader:URLLoader = new URLLoader();
myLoader.dataFormat = URLLoaderDataFormat.TEXT;
var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
myLoader.load(myRequest);
myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
var myValue: String;
function onCompleteHandler(e:Event):void{
var myvariable: URLVariables = new URLVariables(e.target.data);
myValue = myvariable.values;
trace(myValue);
php file
<?php
echo "values=8";
?>
The output finally is "null" in flash file. Why does it happen? It should give me 8 when I input trace(myValue); -
Strange variables retrieved from php script
Hi,
I am experiencing a really strange thing when making my flash
movie communicate with a php script.
No matter what the animation is doing, just consider the
following :
see code below
ticket is the object which receives the response from server
which returns
echo utf8_encode("reponse=ok")
Each time when I run it , (ticket.retour.toString() != "ok")
returns true, and the redirection url shows the following :
http://xx.yy.zz.uu/jeu_avertissement.php?type=PROBLEME_CONNECTION&retour=ok&d=0.02&u=1&k=7 39f4db19af87cc0f2b72a6f63698500
showing value of my retour var which is equal to .... ok
I really don't understand! Could anybody explain me what
happened. It looks like I saw a UFO.
Thanks in advance,
PascalDamn it i found :D
i had to write :
for (i=0; i<_root.tab_result.liste_lenght; i++) {
myCB.addItem(_root.tab_result['ville'+i],_root.tab_result['ville'+i]);
I just hope it could help someone else ahahha
Bye ;)
Séb. -
Passing variables from php to flash and the opposite
Hi guys, im trying weeks now to solve this problem but nothing yet
If someone could just tell me how to pass variables from flash to php and the opposite i would be thankful!!! Please help!I have recently had to learn this, so this may not be the best way but it worked for me
I suggest looking at the code below stripping out everything you don't need (e.g. the databse stuff) and just get a simple string going back and forward
have a go and post any problems here and I'll try and help
in flash i have
private function getBalanceAndXP():void
var request:URLRequest = new URLRequest("utils.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.func = "getBalance";
variables.fbid = userID;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, onBalanceComplete);
loader.load(request);
private function onBalanceComplete(e:Event):void
var loader:URLLoader = e.target as URLLoader;
loader.removeEventListener(Event.COMPLETE, onBalanceComplete);
var variables:URLVariables = new URLVariables(loader.data);
_balance = parseInt(variables.balance); // class variable
_experience = parseInt(variables.experience); // class variable
public function setBalanceAndXP(balance:int, experience:int):void
_balance = balance;
_experience = experience;
var request:URLRequest = new URLRequest("utils.php");
request.method = URLRequestMethod.POST;
var variables:URLVariables = new URLVariables();
variables.func = "setBalance";
variables.fbid = userID;
variables.balance = _balance;
variables.experience = _experience;
request.data = variables;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
and then I have my php file
<?php
$func = $_POST["func"];
$fbid = $_POST["fbid"];
$balance = $_POST["balance"];
$experience = $_POST["experience"];
$numVariables = 0;
$link = mysql_connect("localhost","username","password");
mysql_select_db("databaseName");
if ($func == "getBalance")
getBalance($fbid);
else if ($func == "setBalance")
setBalance($fbid, $balance, $experience);
mysql_close($link);
function getBalance($fbid)
$query = "SELECT balance, experience FROM tableName WHERE fbid = '".$fbid."'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
writeVariable("balance", $row[0]);
writeVariable("experience", $row[1]);
function setBalance($fbid, $balance, $experience)
$query = "UPDATE tableName SET balance = ".$balance.", experience = ".$experience." WHERE fbid ='".$fbid."'";
mysql_query($query);
function writeVariable( $name, $value )
global $numVariables;
if ( $numVariables > 0 )
echo "&";
echo $name . "=" . urlencode($value);
$numVariables++;
?>
Maybe you are looking for
-
hi everybody do u know why we get the error "Error Calling Data Provider" when downloading a file using the fm 'GUI_DOWNLOAD
-
Error while creating procedure and package
Hi, I am getting an error while creating an procedure create or replace procedure mke_test (mke_gender varchar2) is begin declare global temporary table mag_hotline_glob INDIVIDUAL_ID NUMBER, ONE_MONTH NUMBER, THREE_MONTH NUMBER, SIX_MONTH NUMBER, TW
-
Some of the songs in my Itunes library jump to the next song before it finish. What can I do to fix this problem? Please help!!
-
Pixel aspect and downrez to NTSC problem
Okay, I seem to have a complicated problem... 1. I have footage that was shot mostly at 1080p30 on an HVX200 (there is also some 720p60 here and there) 2. I am making an NTSC version, pan and scan, not letterbox, and have my sequence settings set usi
-
How do I stop the login process when I open iTunes?
How do I stop the login process when I open iTunes? It often request I login sometimes twice.