Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- $amount = $_GET['amount'];
- //$customerIp = $_GET['customer_ip'];
- $customerIp = $_SERVER['REMOTE_ADDR'];
- $description = $_GET['description'];
- //$merchantIp = $_GET['merchant_ip'];
- $merchantIp = $_SERVER['SERVER_ADDR'];
- $returnUrl = "https://higoapps.com/api/mandiri-ecash/validate-ipg.php";
- $mid = 'HIGOAPPS';
- $trxid = $_GET['idtrans'];
- $hash = sha1(strtoupper($mid) . $amount . $customerIp);
- $xml_post_string =
- '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.service.gateway.ecomm.ptdam.com/">
- <soapenv:Header/>
- <soapenv:Body>
- <ws:generate>
- <params>
- <amount>' . $amount . '</amount>
- <clientAddress>' . $customerIp . '</clientAddress>
- <description>' . $description . '</description>
- <memberAddress>' . $merchantIp . '</memberAddress>
- <returnUrl>' . $returnUrl . '</returnUrl>
- <toUsername>' . $mid . '</toUsername>
- <hash>' . $hash . '</hash>
- <trxid>' . $trxid . '</trxid>
- </params>
- </ws:generate>
- </soapenv:Body>
- </soapenv:Envelope>';
- $headers = array(
- "Content-type: text/xml;charset=\"utf-8\"",
- "Accept: text/xml",
- "Cache-Control: no-cache",
- "Pragma: no-cache",
- "Content-length: " . strlen($xml_post_string),
- );
- $url = 'https://mandiriecash.com/ecommgateway/services/ecommgwws?wsdl';
- $username = $mid;
- $password = 'A98871A2D438719935D1616125050C47';
- try {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
- curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_post_string);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- // converting
- $response = curl_exec($ch);
- if ($response == false) {
- throw new Exception(curl_error($ch), curl_errno($ch));
- }
- curl_close($ch);
- } catch(Exception $e) {
- trigger_error(sprintf(
- 'Curl failed with error #%d: %s',
- $e->getCode(), $e->getMessage()),
- E_USER_ERROR);
- }
- $parser = simplexml_load_string($response);
- $parserEnv = $parser->children('soap', true);
- $return = $parserEnv->Body->children('ns2', true)->generateResponse->children();
- header("Location:https://mandiriecash.com/ecommgateway/payment.html?id=".$return[0]);
- exit();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement