"; $url = "https://apidpdp.dtac.co.th/digital5/charging/v5.2/getchargingurl"; $data = "{ \"accessInfo\": { \"serviceKey\": \"e0bceee7b45c42a990b26c8410adb55d\", \"accessChannel\": \"WEB\" }, \"charge\": { \"code\": \"48770411001\", \"currency\": \"THB\", \"referenceCode\": \"$ref\" }, \"productInfo\": { \"id\": \"4877\", \"type\": \"Generic\", \"title\": \"4877005\", \"successUrl\": \"https://sec.bearonbee.xyz/dtac/callback?a=success\", \"failureUrl\": \"https://sec.bearonbee.xyz/dtac/callback?a=failure\", \"cancelUrl\": \"https://sec.bearonbee.xyz/dtac/callback?a=cancel\", \"notifyUrl\": \"https://sec.bearonbee.xyz/dtac/callback?a=charging\", \"landingUrl\": \"https://sec.bearonbee.xyz/dtac/callback?a=landing\" } }"; $headers = array( "Content-type: application/json" ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $res = curl_exec($ch); mysqli_query($MyConnect,"INSERT INTO tbl_receiver_dtac_dpdp2 (content,from_url,remark,logtime) VALUES ('$data','$actual_link','request_getchareURL https','$logtime')") or die(mysqli_error()); mysqli_query($MyConnect,"INSERT INTO tbl_receiver_dtac_dpdp2 (content,from_url,remark,logtime) VALUES ('$res','$actual_link','response_getchareURL https','$logtime')") or die(mysqli_error()); $info = json_decode($res,true); $redirect = $info['statusInfo']['chargeRedirectUrl']; header('Location: '.$redirect); curl_close($ch); ?>