[SOLVED] How to push PHP $variable in Curl [GH]

shemzone 09 Nov, 2011
Hello
I'm trying to put some php variables in Curl [GH].
For example, I create the following in a custom code as "controller":
<?php
list($usec, $sec) = explode(" ", microtime());
$temp = ($this->timestamp + $usec - strtotime('today 00:00')) * 10;
$temp = sprintf('%06d',$temp);
$vadstransid=$temp;
return $vadstransid; //If echo, the value is displayed
?>

I want to get this value in the Curl [GH] as:
vads_trans_id=<?php echo $vadstransid ?>

But this is always empty.
Any idea? Did I missed or misunderstood something?

Thanks
Fred
GreyHead 09 Nov, 2011
Hi Fred,

I don't think that I've ever said that PHP is supported there. nor does custom code 'return' anything useful :-(

Instead use a Custom Code action to add the variable to the form data and use the curl brackets syntax.

Custom Code
<?php
list($usec, $sec) = explode(" ", microtime());
$temp = ($this->timestamp + $usec - strtotime('today 00:00')) * 10;
$temp = sprintf('%06d',$temp);
$form->data['vadstransid'] = $temp; //If echo, the value is displayed
?>

and then in the cURL [GH] action put
vads_trans_id={vadstransid}

Bob
shemzone 10 Nov, 2011
Salut Bob

Hi Fred,
I don't think that I've ever said that PHP is supported there. nor doed custom code 'return' anything useful :-(


I never said that you told this was possible🙂 I just asked how to achieve this.
If I said this, then sorry for my bad english.
And thank you, that works. (That is a part of the payment process that I try to do with SystemPay)
Regards
Fred
This topic is locked and no more replies can be posted.