· 4 years ago · Feb 12, 2021, 08:20 AM
1<?php
2ini_set('display_errors', 1);
3ini_set('display_startup_errors', 1);
4error_reporting(E_ALL);
5
6
7$fields['projectCode'] = "TEPS";
8$fields['command'] = "RequestOrderTepsApi";
9$fields['sid'] = "";
10$fields['orderId'] = "5000123";
11$fields['redirectUrl'] = "https://frame.orangeworkshop.info/curl_mpay/post_reg.php"; //ชำระเสร็จแล้วจะส่งลูกค้าไปที่ไหน
12$fields['merchantId'] = "12345678";
13$fields['currency'] = "THB";
14$fields['purchaseAmt'] = "20000";
15$fields['paymentMethod'] = "4";
16$fields['productDesc'] = "This a fan";
17$fields['ref1'] = "";
18$fields['ref2'] = "";
19$fields['ref3'] = "";
20$fields['ref4'] = "";
21$fields['ref5'] = "";
22
23$SecretKey = "";
24$fields['integrityStr'] = hash('sha256',$fields['sid'].$fields['merchantId'].$fields['orderId'].$fields['purchaseAmt'].$SecretKey);
25$fields['orderExpire'] = "10"; //นาที
26
27$fields_string = http_build_query($fields);
28
29$url = "https://chillchill.ais.co.th:8002/AISMPAYPartnerInterface/InterfaceService?%22;
30$useragent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.3 Safari/533.2';
31$ch = curl_init($url);
32curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
33curl_setopt($ch, CURLOPT_ENCODING ,"utf-8");
34curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string);
35curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
36curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
37curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
38curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
39curl_setopt($ch, CURLOPT_HEADER , false);
40$paymenthtml = curl_exec($ch);
41$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
42curl_close($ch);
43var_dump($paymenthtml);
44?>