Browse Source

some edits for angular...

dfstorm 3 months ago
parent
commit
c42bd9f6c6
1 changed files with 15 additions and 12 deletions
  1. 15
    12
      index.php

+ 15
- 12
index.php View File

@@ -13,9 +13,8 @@
13 13
 		It's not allowed to make card data transit trough
14 14
 		your servers in production context.
15 15
 	
16
+	    NOTE: Allow Origin headers are handled by the web server.
16 17
 	*/
17
-	header('Content-Type: application/json');
18
-	header("Access-Control-Allow-Origin: *");
19 18
 	class ksportRelay {
20 19
 		public $rInput = array(
21 20
 			"accessKeyRef"			=> null,
@@ -140,18 +139,22 @@
140 139
 		
141 140
 		// Validate post input.
142 141
 		function input() {
142
+		    $sPostData = file_get_contents("php://input");
143
+	        
144
+	        $rPostData = json_decode($sPostData, true);
145
+		
143 146
 			if (
144
-				isset($_POST['accessKeyRef']) &&
145
-				isset($_POST['data']) &&
146
-				isset($_POST['cardNumber']) &&
147
-				isset($_POST['cardExpirationDate']) &&
148
-				isset($_POST['cardCvx'])
147
+				isset($rPostData['accessKeyRef']) &&
148
+				isset($rPostData['data']) &&
149
+				isset($rPostData['cardNumber']) &&
150
+				isset($rPostData['cardExpirationDate']) &&
151
+				isset($rPostData['cardCvx'])
149 152
 			) {
150
-				$this->rInput["accessKeyRef"]		= $_POST['accessKeyRef'];
151
-				$this->rInput["data"]				= $_POST['data'];
152
-				$this->rInput["cardNumber"]			= $_POST['cardNumber'];
153
-				$this->rInput["cardExpirationDate"]	= $_POST['cardExpirationDate'];
154
-				$this->rInput["cardCvx"]			= $_POST['cardCvx'];
153
+				$this->rInput["accessKeyRef"]		= $rPostData['accessKeyRef'];
154
+				$this->rInput["data"]				= $rPostData['data'];
155
+				$this->rInput["cardNumber"]			= $rPostData['cardNumber'];
156
+				$this->rInput["cardExpirationDate"]	= $rPostData['cardExpirationDate'];
157
+				$this->rInput["cardCvx"]			= $rPostData['cardCvx'];
155 158
 				return true;
156 159
 			} else {
157 160
 				return false;

Loading…
Cancel
Save