/** * @return array */ public function getPaymentHistory() { $paymentHistory = array(); $urls = array(); $urls[] = new \Oara\Curl\Request("{$this->_extension}/affiliate_invoice.html?", array()); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//table[@class="bluetable"]'); $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->item(0))); $num = \count($exportData); for ($i = 4; $i < $num; $i++) { $paymentExportArray = \str_getcsv($exportData[$i], ";"); if (\count($paymentExportArray) > 7) { $obj = array(); $date = \DateTime::createFromFormat("d/m/Y", $paymentExportArray[1]); $obj['date'] = $date->format("Y-m-d H:i:s"); $obj['pid'] = \preg_replace('/[^0-9]/', "", $paymentExportArray[0]); $obj['method'] = 'BACS'; $obj['value'] = \Oara\Utilities::parseDouble($paymentExportArray[4]); $paymentHistory[] = $obj; } } return $paymentHistory; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $urls = array(); $urls[] = new \Oara\Curl\Request('https://www.sportscoverdirect.com/promoters/earn', array()); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " performance ")]'); if (\count($results) > 0) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0))); $num = \count($exportData) - 1; //the last row is show-more show-less for ($i = 1; $i < $num; $i++) { $overviewExportArray = \str_getcsv($exportData[$i], ";"); $transaction = array(); $transaction['merchantId'] = 1; $date = \DateTime::createFromFormat("d/m/Y", $overviewExportArray[0]); $transaction['date'] = $date->format("Y-m-d H:i:s"); $transaction['amount'] = \Oara\Utilities::parseDouble($overviewExportArray[1]); $transaction['commission'] = \Oara\Utilities::parseDouble($overviewExportArray[1]); $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; $totalTransactions[] = $transaction; } } return $totalTransactions; }
/** * @return array */ public function getPaymentHistory() { $paymentHistory = array(); $urls = array(); $urls[] = new \Oara\Curl\Request('http://affiliates.mypcbackup.com/paychecks', array()); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " transtable ")]'); if ($tableList->item(0) != null) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->item(0))); $num = \count($exportData); for ($i = 1; $i < $num; $i++) { $paymentExportArray = \str_getcsv($exportData[$i], ";"); try { $obj = array(); $date = \DateTime::createFromFormat("m/d/Y", $paymentExportArray[14]); $date->setTime(0, 0); $obj['date'] = $date->format("Y-m-d H:i:s"); $obj['pid'] = \preg_replace('/[^0-9\\.,]/', "", $paymentExportArray[14]); $obj['method'] = $paymentExportArray[16]; $obj['value'] = \Oara\Utilities::parseDouble($paymentExportArray[12]); $paymentHistory[] = $obj; } catch (\Exception $e) { echo "Payment failed\n"; } } } return $paymentHistory; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array * @throws Exception */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $urls = array(); $url = "https://foxtransfer.eu/index.php?q=prices.en.html&page=affiliate_orders&language=1&basedir=theme2&what=record_time&what=record_time&fy={$dStartDate->format("Y")}&fm={$dStartDate->format("n")}&fd={$dStartDate->format("j")}&ty={$dEndDate->format("Y")}&tm={$dEndDate->format("n")}&td={$dEndDate->format("j")}"; $urls[] = new \Oara\Curl\Request($url, array()); $exportReport = $this->_client->get($urls); $exportReport = \str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "", $exportReport[0]); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//*[contains(concat(" ", normalize-space(@id), " "), " tartalom-hatter ")]'); $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->item(0))); $num = \count($exportData); for ($i = 11; $i < $num - 8; $i++) { $transactionExportArray = \str_getcsv($exportData[$i], ";"); $transaction = array(); $transaction['merchantId'] = 1; $transaction['unique_id'] = $transactionExportArray[0]; $transaction['date'] = "{$dStartDate->format("Y")}-{$dStartDate->format("m")}-01 00:00:00"; if ($transactionExportArray[7] == "Confirmed") { $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; } else { if ($transactionExportArray[7] == "Cancelled") { $transaction['status'] = \Oara\Utilities::STATUS_DECLINED; } else { throw new \Exception("New status found {$transaction['status']}"); } } $transaction['amount'] = \Oara\Utilities::parseDouble($transactionExportArray[10]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionExportArray[13]); $totalTransactions[] = $transaction; } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $page = 1; $continue = true; while ($continue) { $valuesFormExport = array(); $valuesFormExport[] = new \Oara\Curl\Parameter('dateFrom', $dStartDate->format("d/m/Y")); $valuesFormExport[] = new \Oara\Curl\Parameter('dateTo', $dEndDate->format("d/m/Y")); $valuesFormExport[] = new \Oara\Curl\Parameter('startIndex', $page); $valuesFormExport[] = new \Oara\Curl\Parameter('numberOfPages', '1'); $urls = array(); $urls[] = new \Oara\Curl\Request('https://etrader.kalahari.com/view/affiliate/transactionreport', $valuesFormExport); $exportReport = $this->_client->post($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//table'); $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0))); if (\preg_match("/No results found/", $exportData[1])) { break; } else { $page++; } for ($j = 1; $j < \count($exportData); $j++) { $transactionDetail = \str_getcsv($exportData[$j], ";"); $transaction = array(); $transaction['merchantId'] = "1"; if (\preg_match("/Order dispatched: ([0-9]+) /", $transactionDetail[2], $match)) { $transaction['custom_id'] = $match[1]; } $date = \DateTime::createFromFormat("d M Y", $transactionDetail[0]); $transaction['date'] = $date->format("Y-m-d 00:00:00"); $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; if ($transactionDetail[3] != null) { $transaction['amount'] = \Oara\Utilities::parseDouble($transactionDetail[3]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionDetail[3]); } else { if ($transactionDetail[4] != null) { $transaction['amount'] = \Oara\Utilities::parseDouble($transactionDetail[4]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionDetail[4]); } } $totalTransactions[] = $transaction; } } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $merchantMap = \Oara\Utilities::getMerchantNameMapFromMerchantList($merchantList); $statusArray = array(0, 1, 2); foreach ($statusArray as $status) { $valuesFromExport = array(new \Oara\Curl\Parameter('AfID', '0'), new \Oara\Curl\Parameter('S', ''), new \Oara\Curl\Parameter('ST', '2'), new \Oara\Curl\Parameter('Period', '6'), new \Oara\Curl\Parameter('AdID', '0'), new \Oara\Curl\Parameter('B', '2')); $valuesFromExport[] = new \Oara\Curl\Parameter('SD', $dStartDate->format("Y-m-d")); $valuesFromExport[] = new \Oara\Curl\Parameter('ED', $dEndDate->format("Y-m-d")); $valuesFromExport[] = new \Oara\Curl\Parameter('Status', $status); $urls = array(); $urls[] = new \Oara\Curl\Request('http://www.clixgalore.co.uk/AffiliateTransactionSentReport_Excel.aspx?', $valuesFromExport); $exportReport = $this->_client->get($urls); $exportData = \Oara\Utilities::htmlToCsv($exportReport[0]); $num = \count($exportData); for ($i = 1; $i < $num; $i++) { $transactionExportArray = \str_getcsv($exportData[$i], ";"); if (isset($merchantMap[$transactionExportArray[2]])) { $transaction = array(); $merchantId = (int) $merchantMap[$transactionExportArray[2]]; $transaction['merchantId'] = $merchantId; $transactionDate = \DateTime::createFromFormat("d M Y H:m", $transactionExportArray[0]); $transaction['date'] = $transactionDate->format("Y-m-d H:i:s"); if ($transactionExportArray[6] != null) { $transaction['custom_id'] = $transactionExportArray[6]; } if ($status == 1) { $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; } else { if ($status == 2) { $transaction['status'] = \Oara\Utilities::STATUS_PENDING; } else { if ($status == 0) { $transaction['status'] = \Oara\Utilities::STATUS_DECLINED; } } } $transaction['amount'] = \Oara\Utilities::parseDouble($transactionExportArray[4]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionExportArray[5]); $totalTransactions[] = $transaction; } } } return $totalTransactions; }
/** * @return bool */ public function checkConnection() { $connection = false; $urls = array(); $urls[] = new \Oara\Curl\Request('http://cli.linksynergy.com/cli/publisher/home.php?', array()); $result = $this->_client->get($urls); // Check if the credentials are right if (\preg_match('/https:\\/\\/cli\\.linksynergy\\.com\\/cli\\/common\\/logout\\.php/', $result[0], $matches)) { $urls = array(); $urls[] = new \Oara\Curl\Request('https://cli.linksynergy.com/cli/publisher/my_account/marketingChannels.php', array()); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//table'); foreach ($results as $table) { $tableCsv = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($table)); } $resultsSites = array(); $num = \count($tableCsv); for ($i = 1; $i < $num; $i++) { $siteArray = \str_getcsv($tableCsv[$i], ";"); if (isset($siteArray[2]) && \is_numeric($siteArray[2])) { $result = array(); $result["id"] = $siteArray[2]; $result["name"] = $siteArray[1]; $result["url"] = "https://cli.linksynergy.com/cli/publisher/common/changeCurrentChannel.php?sid=" . $result["id"]; $resultsSites[] = $result; } } $siteList = array(); foreach ($resultsSites as $resultSite) { $site = new \stdClass(); $site->website = $resultSite["name"]; $site->url = $resultSite["url"]; $parsedUrl = \parse_url($site->url); $attributesArray = \explode('&', $parsedUrl['query']); $attributeMap = array(); foreach ($attributesArray as $attribute) { $attributeValue = \explode('=', $attribute); $attributeMap[$attributeValue[0]] = $attributeValue[1]; } $site->id = $attributeMap['sid']; // Login into the Site ID $urls = array(); $urls[] = new \Oara\Curl\Request($site->url, array()); $this->_client->get($urls); $urls = array(); $urls[] = new \Oara\Curl\Request('https://cli.linksynergy.com/cli/publisher/reports/reporting.php', array()); $result = $this->_client->get($urls); if (preg_match_all('/\\"token_one\\"\\: \\"(.+)\\"/', $result[0], $match)) { $site->token = $match[1][0]; } $urls = array(); $urls[] = new \Oara\Curl\Request('http://cli.linksynergy.com/cli/publisher/links/webServices.php', array()); $result = $this->_client->get($urls); if (preg_match_all('/<div class="token">(.+)<\\/div>/', $result[0], $match)) { $site->secureToken = $match[1][1]; } $siteList[] = $site; } $connection = true; $this->_siteList = $siteList; } return $connection; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $valuesFromExport = array(); $valuesFromExport[] = new \Oara\Curl\Parameter('FromDate', $dStartDate->format("d/m/Y")); $valuesFromExport[] = new \Oara\Curl\Parameter('ToDate', $dEndDate->format("d/m/Y")); $valuesFromExport[] = new \Oara\Curl\Parameter('ReportType', 'dailyReport'); $valuesFromExport[] = new \Oara\Curl\Parameter('Link', '-1'); $urls = array(); $urls[] = new \Oara\Curl\Request('https://www.bet365affiliates.com/Members/Members/Statistics/Print.aspx?', $valuesFromExport); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//*[contains(concat(" ", normalize-space(@id), " "), " Results ")]'); if (!\preg_match("/No results exist/", $exportReport[0])) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->current())); $num = \count($exportData); for ($i = 2; $i < $num - 1; $i++) { $transactionExportArray = \str_getcsv($exportData[$i], ";"); $transaction = array(); $transaction['merchantId'] = 1; $transactionDate = \DateTime::createFromFormat("d-m-Y", $transactionExportArray[1]); $transaction['date'] = $transactionDate->format("Y-m-d 00:00:00"); $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; $transaction['amount'] = \Oara\Utilities::parseDouble($transactionExportArray[27]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionExportArray[32]); if ($transaction['amount'] != 0 && $transaction['commission'] != 0) { $totalTransactions[] = $transaction; } } } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $stringToFind = $dStartDate->format("F Y"); $urls = array(); $urls[] = new \Oara\Curl\Request('https://book.terravision.eu/partner/my/payments', array()); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//table'); $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0))); $num = \count($exportData); for ($i = 1; $i < $num; $i++) { $transactionArray = \str_getcsv($exportData[$i], ";"); if ($transactionArray[0] == $stringToFind) { $transaction = array(); $transaction['merchantId'] = 1; $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; $transaction['date'] = $dEndDate->format("Y-m-d H:i:s"); $transaction['amount'] = \Oara\Utilities::parseDouble($transactionArray[1]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionArray[1]); $totalTransactions[] = $transaction; } } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $amountDays = $dStartDate->diff($dEndDate)->days; $auxDate = clone $dStartDate; for ($j = 0; $j <= $amountDays; $j++) { $valuesFormExport = array(); $valuesFormExport[] = new \Oara\Curl\Parameter('date1', $auxDate->format("Y-m-d")); $valuesFormExport[] = new \Oara\Curl\Parameter('date2', $auxDate->format("Y-m-d")); $valuesFormExport[] = new \Oara\Curl\Parameter('prerange', '0'); $urls = array(); $urls[] = new \Oara\Curl\Request('https://affiliate.btguard.com/reports?', $valuesFormExport); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//table[@cellspacing="12"]'); if ($results->length > 0) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0))); for ($z = 1; $z < \count($exportData); $z++) { $transactionLineArray = \str_getcsv($exportData[$z], ";"); $numberTransactions = (int) $transactionLineArray[2]; if ($numberTransactions != 0) { $commission = \Oara\Utilities::parseDouble($transactionLineArray[3]); $commission = (double) $commission / $numberTransactions; for ($y = 0; $y < $numberTransactions; $y++) { $transaction = array(); $transaction['merchantId'] = "1"; $transaction['date'] = $auxDate->format("Y-m-d H:i:s"); $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; $transaction['amount'] = $commission; $transaction['commission'] = $commission; $totalTransactions[] = $transaction; } } } } $auxDate->add(new \DateInterval('P1D')); } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $valuesFormExport = array(); $valuesFormExport[] = new \Oara\Curl\Parameter('periodtype', "fromtolong"); $valuesFormExport[] = new \Oara\Curl\Parameter('fromday', $dStartDate->format("d")); $valuesFormExport[] = new \Oara\Curl\Parameter('frommonth', $dStartDate->format("m")); $valuesFormExport[] = new \Oara\Curl\Parameter('fromyear', $dStartDate->format("Y")); $valuesFormExport[] = new \Oara\Curl\Parameter('today', $dEndDate->format("d")); $valuesFormExport[] = new \Oara\Curl\Parameter('tomonth', $dEndDate->format("m")); $valuesFormExport[] = new \Oara\Curl\Parameter('toyear', $dEndDate->format("Y")); $valuesFormExport[] = new \Oara\Curl\Parameter('Go', 'Go'); $valuesFormExport[] = new \Oara\Curl\Parameter('partnerId', '326'); $valuesFormExport[] = new \Oara\Curl\Parameter('action', 'partnerLeads'); $valuesFormExport[] = new \Oara\Curl\Parameter('subaction', 'RevenueOverTime'); $urls = array(); $urls[] = new \Oara\Curl\Request('https://my.dianomi.com/Campaign-Analysis-378_1.html?', $valuesFormExport); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $results = $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " tabular ")]'); if ($results->length > 0) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($results->item(0))); $num = count($exportData); for ($i = 1; $i < $num; $i++) { $overviewExportArray = \str_getcsv($exportData[$i], ";"); $transaction = array(); $transaction['merchantId'] = 1; $date = \DateTime::createFromFormat("Y-m-d 00:00:00", $overviewExportArray[0]); $transaction['date'] = $date->format("Y-m-d H:i:s"); $transaction['amount'] = $overviewExportArray[1]; $transaction['commission'] = $overviewExportArray[1]; $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; $totalTransactions[] = $transaction; } } return $totalTransactions; }
/** * @param null $merchantList * @param \DateTime|null $dStartDate * @param \DateTime|null $dEndDate * @return array * @throws Exception */ public function getTransactionList($merchantList = null, \DateTime $dStartDate = null, \DateTime $dEndDate = null) { $totalTransactions = array(); $valuesFromExport = array(new \Oara\Curl\Parameter('AffilUI_Filter', ''), new \Oara\Curl\Parameter('AffilUI_FilterStr', ''), new \Oara\Curl\Parameter('AffilUI_FilterTag', ''), new \Oara\Curl\Parameter('AdvancedFilter_State', '0'), new \Oara\Curl\Parameter('AdvancedFilter_nl_stav_id', '0'), new \Oara\Curl\Parameter('AdvancedFilter_nl_invia_id', '1'), new \Oara\Curl\Parameter('AdvancedFilter_departure', '0'), new \Oara\Curl\Parameter('AdvancedFilter_b_show_invoiced', 'on'), new \Oara\Curl\Parameter('AdvancedFilter_date_from', '01.01.2014'), new \Oara\Curl\Parameter('AdvancedFilter_date_to', '31.10.2014'), new \Oara\Curl\Parameter('AdvancedFilter_nl_rows', ''), new \Oara\Curl\Parameter('AdvancedFilter_sent', '1')); $urls = array(); $urls[] = new \Oara\Curl\Request("http://partner2.invia.cz/ikomunity/index.php?k2MAIN[action]=AFFIL_OBJ", $valuesFromExport); $exportReport = $this->_client->get($urls); $doc = new \DOMDocument(); @$doc->loadHTML($exportReport[0]); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//*[contains(concat(" ", normalize-space(@id), " "), " k2table_AffilUI ")]'); if ($tableList->length > 0) { $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->item(0))); $num = \count($exportData); for ($i = 1; $i < $num - 1; $i++) { $transactionExportArray = \explode(";", $exportData[$i]); $transaction = array(); $transactionDate = \DateTime::createFromFormat("d.m.Y", $transactionExportArray[2]); $transaction['date'] = $transactionDate->format("Y-m-d H:i:s"); $status = $transactionExportArray[4]; if ($status == "Zaplaceno") { $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; } else { if ($status == "Neprod�no") { $transaction['status'] = \Oara\Utilities::STATUS_PENDING; } else { if ($status == "Storno") { $transaction['status'] = \Oara\Utilities::STATUS_DECLINED; } else { throw new \Exception("New status found {$status}"); } } } $transaction['amount'] = \Oara\Utilities::parseDouble($transactionExportArray[6]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionExportArray[6]); $transaction['merchantId'] = 1; $transaction['unique_id'] = $transactionExportArray[0]; $totalTransactions[] = $transaction; } } return $totalTransactions; }
private function readTransactions($html) { $totalTransactions = array(); $doc = new \DOMDocument(); @$doc->loadHTML($html); $xpath = new \DOMXPath($doc); $tableList = $xpath->query('//table[@bgcolor="#003366"][@align="center"][@width="100%"]'); $exportData = \Oara\Utilities::htmlToCsv(\Oara\Utilities::DOMinnerHTML($tableList->item(0))); $num = \count($exportData); for ($i = 3; $i < $num; $i++) { $transactionExportArray = \str_getcsv($exportData[$i], ";"); $transaction = array(); $transaction['merchantId'] = 1; $transaction['date'] = \preg_replace("/[^0-9\\-]/", "", $transactionExportArray[0]) . " 00:00:00"; $transactionExportArray[1] = \trim($transactionExportArray[1]); if (\preg_match("/Paid/", $transactionExportArray[1])) { $transaction['status'] = \Oara\Utilities::STATUS_PAID; } else { if (\preg_match("/Pending/", $transactionExportArray[1])) { $transaction['status'] = \Oara\Utilities::STATUS_PENDING; } else { if (\preg_match("/Approved/", $transactionExportArray[1])) { $transaction['status'] = \Oara\Utilities::STATUS_CONFIRMED; } } } $transaction['amount'] = \Oara\Utilities::parseDouble($transactionExportArray[2]); $transaction['commission'] = \Oara\Utilities::parseDouble($transactionExportArray[2]); $totalTransactions[] = $transaction; } return $totalTransactions; }