Dear,
I set a custom code action at the submit event using the following code:
<?
defined('_JEXEC') or die( 'Restricted access' );
include(JPATH_SITE.'/components/com_chronoforms/libraries/includes/xmlrpc.inc');
$USER = 'user_name';
$PASS = 'passwd';
$DB = 'db_name';
$PORT = '8069';
$HOST = 'http://xxxxxxxxx'
$client = new xmlrpc_client("http://xxxxxxxxx:8069/xmlrpc/common");
$msg = new xmlrpcmsg("login");
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($USER, "string"));
$msg->addParam(new xmlrpcval($PASS, "string"));
resp = $client->send($msg);
uid = $resp->value()->scalarval()
echo "Logged in as $USER (uid:$uid)"
// Create a new lead
$arrayVal = array ("contact_name" => new xmlrpcval($name,"string"),
"email_from" => new xmlrpcval($email, "string"),
"phone" => new xmlrpcval($phone, "string"),
"partner_name" => new xmlrpcval($institution, "string"),
"function" => new xmlrpcval($fonction, "string"),
"stage_id" => new xmlrpcval(2, "int"),
"user_id" => new xmlrpcval(false, "boolean"),
"description" => new xmlrpcval($objet, "string")
);
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($PASS, "string"));
$msg->addParam(new xmlrpcval("crm.lead", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
$resp = $client->send($msg);
?>
where name, email, fonction, institution, phone are field name at my chronoform form.
When executing the submit I get the following error message:
Parse error: syntax error, unexpected T_VARIABLE in /home/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(19) : eval()'d code on line 10
Any idea to sort this problem?
I set a custom code action at the submit event using the following code:
<?
defined('_JEXEC') or die( 'Restricted access' );
include(JPATH_SITE.'/components/com_chronoforms/libraries/includes/xmlrpc.inc');
$USER = 'user_name';
$PASS = 'passwd';
$DB = 'db_name';
$PORT = '8069';
$HOST = 'http://xxxxxxxxx'
$client = new xmlrpc_client("http://xxxxxxxxx:8069/xmlrpc/common");
$msg = new xmlrpcmsg("login");
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($USER, "string"));
$msg->addParam(new xmlrpcval($PASS, "string"));
resp = $client->send($msg);
uid = $resp->value()->scalarval()
echo "Logged in as $USER (uid:$uid)"
// Create a new lead
$arrayVal = array ("contact_name" => new xmlrpcval($name,"string"),
"email_from" => new xmlrpcval($email, "string"),
"phone" => new xmlrpcval($phone, "string"),
"partner_name" => new xmlrpcval($institution, "string"),
"function" => new xmlrpcval($fonction, "string"),
"stage_id" => new xmlrpcval(2, "int"),
"user_id" => new xmlrpcval(false, "boolean"),
"description" => new xmlrpcval($objet, "string")
);
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($PASS, "string"));
$msg->addParam(new xmlrpcval("crm.lead", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
$resp = $client->send($msg);
?>
where name, email, fonction, institution, phone are field name at my chronoform form.
When executing the submit I get the following error message:
Parse error: syntax error, unexpected T_VARIABLE in /home/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(19) : eval()'d code on line 10
Any idea to sort this problem?
Hi sidahmed.dine,
It looks as tough you missed as ; at the end of line 8
Bob
PS Please don't ask the same question here and in a PM - it wastes your time and mine.
It looks as tough you missed as ; at the end of line 8
$HOST = 'http://xxxxxxxxx'
Bob
PS Please don't ask the same question here and in a PM - it wastes your time and mine.
Dear,
I thankd you for your support.
I made the changes and made some modification in the code. Now, I get another issue (see bellow debugger result)
Bellow the modified code:
<?
defined('_JEXEC') or die( 'Restricted access' );
include(JPATH_SITE.'/components/com_chronoforms/libraries/includes/xmlrpc.inc');
$USER = 'username';
$PASS = 'password';
$DB = 'dbname';
$PORT = '8069';
$HOST = 'http://xxx.xxx.xxx.xxx';
$client = new xmlrpc_client("http://xxx.xxx.xxx.xxx:8069/xmlrpc/common");
$msg = new xmlrpcmsg("login");
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($USER, "string"));
$msg->addParam(new xmlrpcval($PASS, "string"));
resp = $client->send($msg);
uid = $resp->value()->scalarval();
echo "Logged in as $USER (uid:$uid)";
// Create a new lead
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$institution = $_POST['institution'];
$function = $_POST['fonction'];
$stage = '2';
$userid = 'false';
$arrayVal = array("contact_name" -> $name,
"email_from" -> $email,
"phone" -> $phone,
"partner_name" -> $institution,
"function" -> $function,
"stage_id" -> $stage,
"user_id" -> $userid
);
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($PASS, "string"));
$msg->addParam(new xmlrpcval("crm.lead", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
$resp = $client->send($msg);
?>
Here is the debugger results:
Data Array:
Array
(
[chronoform] => downcatoe
[event] => submit
[cmp] =>
[genre] => Homme
[name] => Name
[phone] => 1234567
[email] => xxxxxxx.xxx@gmail.com
[pays] => MAROC
[fonction] => Fonction
[institution] => Company Name
[chrono_verification] => aV5ix
[valide] => Valider votre demande
[ebcf794fc6ab012a0569cd56ab7fc73f] => 1
)
Validation Errors:
Array
(
)
Parse error: syntax error, unexpected '=' in /home/public_html/administrator/components/com_chronoforms/form_actions/custom_code/cfaction_custom_code.php(16) : eval()'d code on line 15
Debug Data
Core Captcha
Passed the core captcha check!
I thankd you for your support.
I made the changes and made some modification in the code. Now, I get another issue (see bellow debugger result)
Bellow the modified code:
<?
defined('_JEXEC') or die( 'Restricted access' );
include(JPATH_SITE.'/components/com_chronoforms/libraries/includes/xmlrpc.inc');
$USER = 'username';
$PASS = 'password';
$DB = 'dbname';
$PORT = '8069';
$HOST = 'http://xxx.xxx.xxx.xxx';
$client = new xmlrpc_client("http://xxx.xxx.xxx.xxx:8069/xmlrpc/common");
$msg = new xmlrpcmsg("login");
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($USER, "string"));
$msg->addParam(new xmlrpcval($PASS, "string"));
resp = $client->send($msg);
uid = $resp->value()->scalarval();
echo "Logged in as $USER (uid:$uid)";
// Create a new lead
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$institution = $_POST['institution'];
$function = $_POST['fonction'];
$stage = '2';
$userid = 'false';
$arrayVal = array("contact_name" -> $name,
"email_from" -> $email,
"phone" -> $phone,
"partner_name" -> $institution,
"function" -> $function,
"stage_id" -> $stage,
"user_id" -> $userid
);
$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($DB, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($PASS, "string"));
$msg->addParam(new xmlrpcval("crm.lead", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($arrayVal, "struct"));
$resp = $client->send($msg);
?>
Here is the debugger results:
Data Array:
Array
(
[chronoform] => downcatoe
[event] => submit
[cmp] =>
[genre] => Homme
[name] => Name
[phone] => 1234567
[email] => xxxxxxx.xxx@gmail.com
[pays] => MAROC
[fonction] => Fonction
[institution] => Company Name
[chrono_verification] => aV5ix
[valide] => Valider votre demande
[ebcf794fc6ab012a0569cd56ab7fc73f] => 1
)
Validation Errors:
Array
(
)
Parse error: syntax error, unexpected '=' in /home/public_html/administrator/components/com_chronoforms/form_actions/custom_code/cfaction_custom_code.php(16) : eval()'d code on line 15
Debug Data
Core Captcha
Passed the core captcha check!
Hi sidhmed.dine,
This is not a ChronoForms problem, so far both your posts have been errors in your PHP. It's not my job here to debug your PHP. Please check your own code before posting!!
PHP variables have to start with $, these ones don't
Bob
This is not a ChronoForms problem, so far both your posts have been errors in your PHP. It's not my job here to debug your PHP. Please check your own code before posting!!
PHP variables have to start with $, these ones don't
resp = $client->send($msg);
uid = $resp->value()->scalarval();
Bob
This topic is locked and no more replies can be posted.