Sadikxd Posted February 8, 2017 Share Posted February 8, 2017 Esitmados, tengo el siguiente codigo {php} function CallCreateSessionTokenAPI($method, $url, $data = false, $accessKeyId, $secretAccessKey, $sessionToken){ $curl = curl_init(); switch ($method){ case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // Optional Authentication: curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); $credentials = $accessKeyId . ":" . $secretAccessKey; //echo($credentials); curl_setopt($curl, CURLOPT_USERPWD, $credentials); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $headers = array( 'Content-Type: application/json', 'VisaNet-Session-Key: ' . $sessionToken ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($curl); curl_close($curl); curl_close($curl); echo "<br>"; echo "YEP"; echo "<br>"; echo $err; echo "<br>"; echo $errmsg; echo "<br>"; echo $header; echo "<br>"; echo "*************"; echo "<br>"; echo $result; echo "*************"; echo "<br>"; return $result; return $result; } function GUID(){ if (function_exists('com_create_guid') === true){ return trim(com_create_guid(), '{}'); } return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)); } $sessionToken = GUID(); {assign var="editable" value=$sessionToken}; $amount = 2; $accessKeyId = 'AKIAI232EW7F22U6A'; $secretAccessKey = 'qMuTG6R7EUSF4lhlY62UaEkjWtzNU9gyWY'; $merchantId = 115015006; $urlApiCe= "2"; $qa_true= "?qa=true"; $tokenRequest = '{ "amount": "' . $amount . '"}'; echo "<br>"; echo $sessionToken; echo "<br>"; echo "<br>"; echo $tokenRequest; echo "<br>"; echo "<br>"; echo $urlCreateSessionTokenAPI; echo "<br>"; $resultString = CallCreateSessionTokenAPI('POST', $urlCreateSessionTokenAPI, $tokenRequest, $accessKeyId, $secretAccessKey, $sessionToken); {/php} dentro de mi :TPL como puedo accesar los valores de las variables PHP en mi archivo tpl. NOTA: todo esta en el archivo tpl no esta separado. Saludos, Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now