├── cookie.txt ├── .idea ├── vcs.xml └── misc.xml ├── index.php ├── manager ├── TrueWallet.php └── Curl.php └── README.md /cookie.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | get_transactions($username, $password); 14 | echo "
";
15 | 	print_r($transaction);
16 | 	echo "
"; 17 | 18 | /** 19 | ฟังก์ชั้นนี้จะดึง ข้อมูลการโอนอย่างละเอียด ของแต่ละรายการ ที่ได้จาก get_transections() 20 | ซึ่ง จำเป็นจะต้องใช้ reportID 21 | 22 | ข้อมูลที่ได้ออกมาจะรวมถึง 'หมายเลขอ้างอิง' และวันที่เวลาในการโอนด้วย 23 | **/ 24 | // 25 | $report = $wallet->get_report($transaction[0]->reportID); 26 | echo "
";
27 | 	var_dump($report);
28 | 	echo "
"; 29 | 30 | 31 | 32 | //หากใช้แล้วชอบใจ ให้ค่ามาม่า ผมได้ที่ paypal :: tkaewkunha@gmail.com นะครับ จะถือเป็นความกรุณาอย่างสุดซึ้ง 33 | 34 | ?> -------------------------------------------------------------------------------- /manager/TrueWallet.php: -------------------------------------------------------------------------------- 1 | curl = new Curl(); 10 | } 11 | 12 | public function get_transactions($email, $password){ 13 | $email = str_replace('@', '%40', $email); 14 | $data = "email=".$email."&password=".$password; 15 | $login = $this->curl->login($this->url, $data); 16 | $trans = $this->curl->grab_page($this->trans_history_link); 17 | 18 | if (strpos($trans, 'Whoops') !== false) { 19 | return 'Can not login
'; 20 | } 21 | $trans_obj = json_decode($trans); 22 | $arr_trans = $trans_obj->data->activities; 23 | return $arr_trans; 24 | } 25 | 26 | public function get_report($report_id){ 27 | $report = $this->curl->grab_page($this->reportLink.$report_id); 28 | $json_report = json_decode($report); 29 | return $json_report; 30 | } 31 | } 32 | ?> -------------------------------------------------------------------------------- /manager/Curl.php: -------------------------------------------------------------------------------- 1 | cookie, "w"); 11 | fclose($fp); 12 | 13 | $login = curl_init(); 14 | curl_setopt($login, CURLOPT_SSL_CIPHER_LIST, 'SSLv3'); 15 | curl_setopt($login, CURLOPT_COOKIEJAR, $this->cookie); 16 | curl_setopt($login, CURLOPT_COOKIEFILE, $this->cookie); 17 | curl_setopt($login, CURLOPT_TIMEOUT, 40000); 18 | curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE); 19 | curl_setopt($login, CURLOPT_URL, $url); 20 | curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"); 21 | curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE); 22 | curl_setopt($login, CURLOPT_POST, TRUE); 23 | curl_setopt($login, CURLOPT_POSTFIELDS, $data); 24 | curl_setopt($login, CURLOPT_POSTFIELDS, $data); 25 | ob_start(); 26 | 27 | if (curl_exec($login) === FALSE) { 28 | die("Curl Failed: " . curl_error($login)); 29 | } else { 30 | return curl_exec($login); 31 | } 32 | } 33 | 34 | public function grab_page($site){ 35 | if(file_exists($this->cookie)){ 36 | // ตั้งเงื่อนไขต่างๆได้ตามใจเลยจ้า; 37 | }else{ 38 | 39 | } 40 | 41 | $ch = curl_init(); 42 | curl_setopt($ch, CURLOPT_SSLVERSION, 'SSLv3'); 43 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); 44 | curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"); 45 | curl_setopt($ch, CURLOPT_TIMEOUT, 40); 46 | curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie); 47 | curl_setopt($ch, CURLOPT_URL, $site); 48 | ob_start(); 49 | ob_end_flush(); 50 | 51 | if (curl_exec($ch) === FALSE) { 52 | die("Curl Failed: " . curl_error($ch)); 53 | } else { 54 | return curl_exec($ch); 55 | } 56 | } 57 | } 58 | ?> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # true-wallet-crewler 2 | 3 | # เกี่ยวกับ 4 | 5 | โค๊ดดึงข้อมูลข้อทางการเงินของบัญชี True Wallet สามารถดึงข้อมูลทางการเงินย้อนหลังของบัญชีทรูวอลเลตได้ รวมไปถึงรายละเอียดเช่น วันที่ เวลา ที่โอน เบอร์โทร ชื่อผู้ทำรายการ รวมไปถึงหมายเลขอ้างอิง (Transaction ID)ซึ่งเป็นหมายเลขประจำรายการนั้นๆและเป็นเลขที่ไม่ซ้ำกับรายการอื่น 6 | ซึ่งเมื่อได้หมายเลขโทรศัพ และ หมายเลขอ้างอิงนี้แล้ว สามารถ นำไปประยุคสร้าง ระบบส่งของให้กับลูกค้าอัตโนมัติผ่านทางอีเมลได้ 7 | 8 | เช่น ขาย ระหัสเกม ราคา 1500 บาท 9 | เมื่อลูกค้าโอนเงินเข้ามาในบัญชีคุณ 1500 บาทแล้ว ให้ลูกค้ากดยืนยันการโอน 10 | และให้ลูกค้า กรอกหมายเลขอ้างอิงการโอน และเบอร์โทรศัพท์ที่โอน เพื่อยืนยันการโอนเงิน 11 | จากนั้นคุณก็เขียนโค๊ดให้ส่งระหัส ที่เป็นสินค้าของคุณให้กับลูกค้าได้โดยอัตโนมัติ 12 | 13 | # การทำงาน 14 | 15 | การทำงานของโค๊ดชุดนี้ จะส่ง Request Login ไปยัง TrueWallet และดึงข้อออกมา โดยใช้ Curl โดยโค๊ดนี้ไม่มีการเก็บข้อมูลของท่านแต่อย่างใด(ไม่เชื่อก็ลองไล่โค๊ดดูได้ครับแหะๆ) 16 | 17 | # วิธีใช้ 18 | ที่ index.php จะมีตัวอย่างการใช้งานพร้อมคำอธิบายอยู่ แต่ผมจะอธิบายให้อีกรอบ 19 | แก้ไขตัวแปร username , password ให้ตรงามข้อมูลจริงของท่าน 20 | 21 | function get_transections() 22 | จะดึงข้อมูลการโอน รับ เงินคร่าวทั้งหมดของท่านออกมา มากสุดที่ 50 รายการ 23 | 24 | function get_retport() 25 | ฟังก์ชั้นนี้จะดึง ข้อมูลการโอนอย่างละเอียด ของแต่ละรายการ ที่ได้จาก get_transections() 26 | ซึ่ง จำเป็นจะส่งเป็น reportID ให้กับฟังก์ชั้นนี้ ซึ่งผมที่ได้จาก ฟังก์ชั่นนี้จะละเอียดไปจนถึง วันเวลา ที่โอน ชื่อผู้โอน ข้อความจากผู้โอน รวมไปถึงหมายเลขอ้างอิงด้วย 27 | 28 | 29 | # ตัวอย่างข้อมูล 30 | 31 | ตัวอย่างข้อมูลที่ได้จาก get_transactions() 32 | 33 | [0] => stdClass Object 34 | ( 35 | [reportID] => 29013674 36 | [logoURL] => https://s3-ap-southeast-1.amazonaws.com/mobile-resource.tewm/wallet-app/common/icon-transaction/m/images/logo_activity_type/transfer_debtor.png 37 | [text1Th] => โอนเงิน 38 | [text1En] => Transfer 39 | [text2Th] => 11/11/16 40 | [text2En] => 11/11/16 41 | [text3Th] => โอนเงินให้ 42 | [text3En] => debtor 43 | [text4Th] => -4,500.00 44 | [text4En] => -4,500.00 45 | [text5Th] => 093-427-1147 46 | [text5En] => 093-427-1147 47 | ) 48 | 49 | [1] => stdClass Object 50 | ( 51 | [reportID] => 1006447327 52 | [logoURL] => https://s3-ap-southeast-1.amazonaws.com/mobile-resource.tewm/wallet-app/common/icon-transaction/m/images/logo_activity_type/add_money.png 53 | [text1Th] => เติมเงิน Wallet 54 | [text1En] => Add Money 55 | [text2Th] => 11/11/16 56 | [text2En] => 11/11/16 57 | [text3Th] => 7-ELEVEN 58 | [text3En] => 7-ELEVEN 59 | [text4Th] => +1,000.00 60 | [text4En] => +1,000.00 61 | [text5Th] => 62 | [text5En] => 63 | ) 64 | 65 | [2] => stdClass Object 66 | ( 67 | [reportID] => 1006447326 68 | [logoURL] => https://s3-ap-southeast-1.amazonaws.com/mobile-resource.tewm/wallet-app/common/icon-transaction/m/images/logo_activity_type/add_money.png 69 | [text1Th] => เติมเงิน Wallet 70 | [text1En] => Add Money 71 | [text2Th] => 11/11/16 72 | [text2En] => 11/11/16 73 | [text3Th] => 7-ELEVEN 74 | [text3En] => 7-ELEVEN 75 | [text4Th] => +2,000.00 76 | [text4En] => +2,000.00 77 | [text5Th] => 78 | [text5En] => 79 | ) 80 | 81 | [3] => stdClass Object 82 | ( 83 | [reportID] => 1006447304 84 | [logoURL] => https://s3-ap-southeast-1.amazonaws.com/mobile-resource.tewm/wallet-app/common/icon-transaction/m/images/logo_activity_type/add_money.png 85 | [text1Th] => เติมเงิน Wallet 86 | [text1En] => Add Money 87 | [text2Th] => 11/11/16 88 | [text2En] => 11/11/16 89 | [text3Th] => 7-ELEVEN 90 | [text3En] => 7-ELEVEN 91 | [text4Th] => +2,000.00 92 | [text4En] => +2,000.00 93 | [text5Th] => 94 | [text5En] => 95 | ) 96 | [4] 97 | . 98 | . 99 | . 100 | 101 | 102 | ตัวอย่างข้อมูลที่ได้จาก get_report() 103 | 104 | object(stdClass)#3 (8) { 105 | ["code"]=> 106 | string(5) "20000" 107 | ["namespace"]=> 108 | string(11) "TMN-PRODUCT" 109 | ["titleTh"]=> 110 | string(0) "" 111 | ["titleEn"]=> 112 | string(0) "" 113 | ["messageTh"]=> 114 | string(178) "คุณสามารถเช็ครายการย้อนหลัง 115 | ได้ที่เมนูประวัติการทำรายการ 116 | [APR-20000]" 117 | ["messageEn"]=> 118 | string(178) "คุณสามารถเช็ครายการย้อนหลัง 119 | ได้ที่เมนูประวัติการทำรายการ 120 | [APR-20000]" 121 | ["originalMessage"]=> 122 | string(0) "" 123 | ["data"]=> 124 | object(stdClass)#54 (11) { 125 | ["amount"]=> 126 | int(-4500) 127 | ["ref1"]=> 128 | string(10) "0934271147" 129 | ["section4"]=> 130 | object(stdClass)#57 (2) { 131 | ["column1"]=> 132 | object(stdClass)#56 (1) { 133 | ["cell1"]=> 134 | object(stdClass)#55 (3) { 135 | ["titleTh"]=> 136 | string(31) "วันที่-เวลา" 137 | ["titleEn"]=> 138 | string(16) "Transaction date" 139 | ["value"]=> 140 | string(14) "11/11/16 22:06" 141 | } 142 | } 143 | ["column2"]=> 144 | object(stdClass)#59 (1) { 145 | ["cell1"]=> 146 | object(stdClass)#58 (3) { 147 | ["titleTh"]=> 148 | string(39) "เลขที่อ้างอิง" 149 | ["titleEn"]=> 150 | string(14) "Transaction ID" 151 | ["value"]=> 152 | string(10) "1706xxxxxxx" 153 | } 154 | } 155 | } 156 | ["serviceCode"]=> 157 | string(6) "debtor" 158 | ["section3"]=> 159 | object(stdClass)#63 (2) { 160 | ["column1"]=> 161 | object(stdClass)#61 (2) { 162 | ["cell2"]=> 163 | object(stdClass)#60 (3) { 164 | ["titleTh"]=> 165 | string(30) "ยอดเงินรวม" 166 | ["titleEn"]=> 167 | string(12) "total amount" 168 | ["value"]=> 169 | string(8) "4,500.00" 170 | } 171 | ["cell1"]=> 172 | object(stdClass)#62 (3) { 173 | ["titleTh"]=> 174 | string(45) "จำนวนเงินที่โอน" 175 | ["titleEn"]=> 176 | string(6) "amount" 177 | ["value"]=> 178 | string(8) "4,500.00" 179 | } 180 | } 181 | ["column2"]=> 182 | object(stdClass)#65 (1) { 183 | ["cell1"]=> 184 | object(stdClass)#64 (3) { 185 | ["titleTh"]=> 186 | string(36) "ค่าธรรมเนียม" 187 | ["titleEn"]=> 188 | string(9) "total fee" 189 | ["value"]=> 190 | string(4) "0.00" 191 | } 192 | } 193 | } 194 | ["personalMessage"]=> 195 | object(stdClass)#66 (1) { 196 | ["value"]=> 197 | string(0) "" 198 | } 199 | ["section2"]=> 200 | object(stdClass)#70 (2) { 201 | ["column1"]=> 202 | object(stdClass)#68 (2) { 203 | ["cell2"]=> 204 | object(stdClass)#67 (3) { 205 | ["titleTh"]=> 206 | string(30) "ชื่อผู้รับ" 207 | ["titleEn"]=> 208 | string(13) "account owner" 209 | ["value"]=> 210 | string(13) "name*** las***" 211 | } 212 | ["cell1"]=> 213 | object(stdClass)#69 (3) { 214 | ["titleTh"]=> 215 | string(39) "หมายเลขผู้รับ" 216 | ["titleEn"]=> 217 | string(14) "account number" 218 | ["value"]=> 219 | string(12) "093-427-xxxx" 220 | } 221 | } 222 | ["column2"]=> 223 | object(stdClass)#71 (1) { 224 | ["operator"]=> 225 | string(3) "tmn" 226 | } 227 | } 228 | ["section1"]=> 229 | object(stdClass)#72 (2) { 230 | ["titleTh"]=> 231 | string(30) "โอนเงินให้" 232 | ["titleEn"]=> 233 | string(6) "debtor" 234 | } 235 | ["isFavorited"]=> 236 | string(2) "no" 237 | ["isFavoritable"]=> 238 | string(2) "no" 239 | ["serviceType"]=> 240 | string(8) "transfer" 241 | } 242 | } 243 | 244 | # ทิ้งทาย 245 | โค๊ดนี้ฟรีครับ 246 | ถ้าใช้แล้วถูกใจ แล้วกรุณาอยากสนับสนุนก็สามารถทำได้ที่ paypal : tkaewkunha@gmail.com จะถือเป็นความกรุณาอย่างสูงครับ 247 | --------------------------------------------------------------------------------