Example #1
0
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new Kijiji divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.kijijideals.ca/deals/toronto/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("KijijiCity.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'class="list"', '>', '</div>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     $DataArray = explode('</li>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'http://www.kijijideals.ca/deals/') !== false) {
             $ID = FindSubData($DataItem, 'http://www.kijijideals.ca/deals', "/", "/", false);
             $Name = FindSubData($DataItem, 'http://www.kijijideals.ca/deals/', '>', '</a', false);
             //$Name = CleanHTML(str_ireplace(' - English', '', $Name));
             if ($Name !== false) {
                 $Name = CleanHTML($Name);
             }
             if ($Name != '' && $Name !== false && $ID !== false) {
                 if (!CheckURL('Kijiji', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('Kijiji', $SID);
 }
Example #2
0
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new EverybodyBuys divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://everybodybuys.com'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("EverybodyBuysCity.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'id="change-city"', '>', '</select>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     $DataArray = explode('/option', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'value=') !== false) {
             //IF no value=, strip tag
             $ID = FindSubData($DataItem, 'value=', "'", "'", false);
             $Name = FindSubData($DataItem, 'value=', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if (stripos($Name, '(') !== false) {
                     $Name = trim(substr($Name, 0, stripos($Name, '(')));
                 }
                 if (!CheckURL('EverybodyBuys', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('EverybodyBuys', $SID);
 }
Example #3
0
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new DealTicker divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.dealticker.com/toronto_en_1categ.html'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("DealTickerCity.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'class="select_cities_left"', '</div></div>', '</div>	</div>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     //Parse contents of city box
     $DataArray = explode('/a>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'a href=') !== false) {
             $ID = FindSubData($DataItem, 'a href=', 'dealticker.com', '"', false);
             $Name = FindSubData($DataItem, 'a href=', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if (stripos($Name, '&nbsp;') !== false) {
                     $Name = substr($Name, 0, stripos($Name, '&nbsp;'));
                 }
                 if (!CheckURL('DealTicker', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('DealTicker', $SID);
 }
Example #4
0
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new DealOn divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.dealon.com/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("DealOn.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'id="city_id"', '>', '</select>', false);
     //Go to the 1st ending of Label
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     $DataArray = explode('/option', $DataArray);
     //explode by option
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'value=') !== false) {
             $ID = FindSubData($DataItem, 'value=', '"', '"', false);
             //Get Sublink from URL
             $Name = FindSubData($DataItem, 'value=', '>', '<', false);
             //Get Name of the City
             if ($Name !== false && $ID !== false) {
                 if (!CheckURL('DealOn', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('DealOn', $SID);
 }
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new RedFlagDeals divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://dealoftheday.redflagdeals.com/deal/toronto'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("RedFlagDealsCity.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'categoryListBoxV2', '>', '</div>' . chr(13) . chr(10) . chr(9) . '</div>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     $DataArray = explode('</div>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'categoryNameV2') !== false) {
             $ID = FindSubData($DataItem, 'selectCategory(', "'", "'", false);
             $Name = FindSubData($DataItem, 'categoryNameV2', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if (!CheckURL('RedFlagDeals', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('RedFlagDeals', $SID);
 }
Example #6
0
 public function GetNewDivisions($SID)
 {
     SysLogIt('Checking for new WagJag divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.wagjag.com/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     SysLogIt('Parsing HTML.');
     if (!($DataArray = FindSubData($Data, 'id="city_regions"', '>', '</form>', false))) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     //Large Centres
     $DataArray = explode('class="city_name"', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'href="/?c=') !== false) {
             $ID = FindSubData($DataItem, 'href=', '"', '"', false);
             $Name = FindSubData($DataItem, 'href=', ">", "<", false);
             if ($Name !== false && $ID !== false) {
                 if (!CheckURL('WagJag', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('WagJag', $SID);
 }
Example #7
0
 public function GetNewDivisions($SID)
 {
     SysLogIt('Checking for new StealTheDeal divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.stealthedeal.com/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     //file_put_contents("StealTheDeal.txt", $Data);
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, '"locationPanel"', '<ul>', '</ul>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     //Large Centres
     $DataArray = explode('</li>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'href=') !== false) {
             $ID = FindData($DataItem, 'href="/', '"', 7, 0, false, 0, false);
             $Name = FindSubData($DataItem, 'href=', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if ($Name == '') {
                     $Name = ucwords($ID);
                 }
                 if (!CheckURL('StealTheDeal', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('StealTheDeal', $SID);
 }
Example #8
0
 public function GetNewDivisions($SID)
 {
     SysLogIt('Checking for new PriceDodger divisions.');
     if (!(list($Data, $DURL) = GetWebData('http://www.pricedodger.com/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'class="cities-list', '>', '</ol>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     //Parse contents of city box
     $DataArray = explode('</li>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'href=') !== false) {
             $ID = FindSubData($DataItem, 'a href=', '"', '"', false);
             $Name = FindSubData($DataItem, 'a href=', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if (!CheckURL('PriceDodger', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('PriceDodger', $SID);
 }
Example #9
0
 public function GetNewDivisions($SID)
 {
     global $DebugMode;
     SysLogIt('Checking for new WebPiggy divisions.');
     if (!(list($Data, $DURL) = GetWebData('https://www.webpiggy.com/'))) {
         return SysLogIt('Error getting web data.', StatusError);
     }
     if ($DebugMode) {
         file_put_contents("WebPiggyCity.txt", $Data);
     }
     SysLogIt('Parsing HTML.');
     $DataArray = FindSubData($Data, 'id="city_list"', '>', '</ul>', false);
     if ($DataArray === false) {
         return SysLogIt("Couldn't find city content.", StatusError);
     }
     $DataArray = explode('/a></li>', $DataArray);
     foreach ($DataArray as $DataItem) {
         if (stripos($DataItem, 'a href="/') !== false) {
             $ID = FindSubData($DataItem, 'a href="', '/', '"', false);
             $Name = FindSubData($DataItem, 'a href="', '>', '<', false);
             if ($Name !== false && $ID !== false) {
                 if (!CheckURL('WebPiggy', $SID, $Name, $ID)) {
                     return false;
                 }
             }
         }
     }
     return UpStatus('WebPiggy', $SID);
 }
Example #10
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.groupon.com/' . $URL, null, 'visited=true');
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Groupon.txt", 'http://www.groupon.com/' . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'pledge_id') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', 'Groupon.currentDeal.permalink', '"', '"', false), "Title" => array('', 'Groupon.currentDeal.title', '"', '"', false), "Website" => array('', "class='company_links", 'href="', '"', false, true), "PriceSale" => array(0, 'id="amount"', '$', '<', true), "PriceReg" => array(0, "id='deal_discount'", '$', '<', true), "StoreName" => array('', "class='name'", '>', '<', false), "Description" => array('', "class='pitch_content'", ">", '</div>', false), "Address" => array('', "class='address'", '<p>', '<a', false, true), "EndDate" => array(0, 'data-deadline=', "'", "'", true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = $NewDeal['EndDate'][0];
     if ($EndDate === false || $EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindSubData($Data, '<li>Expires', ' ', '<', false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = CleanHTML(str_ireplace("Today's Deal:", "", $NewDeal['Title'][0]));
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.groupon.com/deals/' . $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $Website;
     $RData['Locations'] = array(array($Address, 0, 0));
     return array(true, array($RData));
 }
Example #11
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.dealicious.ca/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Dealicious.txt", "http://www.dealicious.ca/" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'manageDeal1') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', '?dealId', '=', '"', false), "Title" => array('', 'class="OfferTitle_Homepage"', '</span>', '</div>', false), "Website" => array('', 'class="maplocation"', 'href="', '"', false, true), "PriceSale" => array(0, 'class="pricebox-left"', '<span>', '<', true), "PriceReg" => array(0, 'class="value"', '$', '<', true), "StoreName" => array('', 'class="maplocation"', '<h2>', '</h2>', false), "Description" => array('', '<!-- Company details', '<p>', '</p>', false), "Address" => array('', 'class="maplocation"', '</h2>', '</div>', false, true), "EndY" => array(0, "'year'", ':', ',', true), "EndM" => array(0, "'month'", ':', ',', true), "EndD" => array(0, "'day'", ':', ',', true), "EndH" => array(0, "'hour'", ':', ',', true), "EndN" => array(0, "'min'", ':', ',', true), "EndS" => array(0, "'sec'", ':', '}', true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = mktime((int) $NewDeal['EndH'][0], (int) $NewDeal['EndN'][0], (int) $NewDeal['EndS'][0], (int) $NewDeal['EndM'][0], (int) $NewDeal['EndD'][0], (int) $NewDeal['EndY'][0]);
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindSubData($Data, 'Expires on', '</strong>', '</div>', false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = CleanHTML(str_ireplace("Today's Deal:", "", $NewDeal['Title'][0]));
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.dealicious.ca/index.php?deal=' . $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $Website;
     $RData['Locations'] = array(array($Address, 0, 0));
     return array(true, array($RData));
 }
Example #12
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.swarmjam.com/waf.srv/sj/sj/cn/auction_ActionProdDet?ONSUCCESS=swarmofferdet.jsp&PRODID=' . $URL);
     } else {
         list($Data, $DURL) = GetWebData('http://www.swarmjam.com/waf.srv/sj/sj/cn/auction_ActionProdCat?ONSUCCESS=home.jsp&ONERR1=home.jsp&ONERR2=home.jsp&CATID=' . $URL . '#');
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("SwarmJam.txt", $Data);
     }
     if (stripos($Data, 'href="https://') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'href="https://', '&PRODID=', '"', true), "Title" => array('', 'class="offerTitle"', '>', '</div>', false), "VendorID" => array(0, 'venddet.jsp', '&ONERR2=venddet.jsp&VENDID=', '"', true), "Website" => array('', '<p><a href="http:', '//', '"', false, true), "PriceSale" => array(0, '>Buy', '$', '<', true), "PriceReg" => array(0, '>Value:', '$', '<', true, true), "Savings" => array(0, '>Buy', '(', '%', true, true), "Description" => array('', 'More About This Deal', '<p>', '</p>', false), "AdrA" => array('', chr(9) . 'v_address =', '"', '"', false, true), "AdrC" => array('', chr(9) . 'v_city =', '"', '"', false, true), "AdrS" => array('', chr(9) . 'v_state =', '"', '"', false, true), "AdrP" => array('', chr(9) . 'v_state =', '</script>', '</p>', false, true), "EndD" => array(0, 'id="cx-cnt-int-day"', '>', '<', true, true), "EndH" => array(0, 'id="cx-cnt-int-hou"', '>', '<', true, true), "EndM" => array(0, 'id="cx-cnt-int-min"', '>', '<', true, true), "EndS" => array(0, 'id="cx-cnt-int-sec"', '>', '<', true, true), "Expiry" => array('', 'Expiry Date:', 'document.write("', '")', false, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     list($SubData, $DURL) = GetWebData('http://www.swarmjam.com/waf.srv/sj/sj/cn/auction_ActionProdVend?ONSUCCESS=venddet.jsp&ONERR2=venddet.jsp&VENDID=' . (int) $NewDeal['VendorID'][0]);
     if ($SubData === false) {
         return array(SysLogIt('Error retrieving vendor information.', StatusError), null);
     }
     $StoreName = FindSubData($SubData, 'id="ctyx-content"', 'About ', '<');
     if ($StoreName === false) {
         return array(SysLogIt('Error finding vendor information.', StatusError), null);
     }
     if ($NewDeal['PriceReg'][0] !== false) {
         $PriceReg = (double) $NewDeal['PriceReg'][0];
     } elseif ($NewDeal['Savings'][0] !== false) {
         $PriceReg = $NewDeal['PriceSale'][0] / ((100 - $NewDeal['Savings'][0]) / 100);
     } else {
         return array(SysLogIt('Error determining regular price.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = time();
     if ($NewDeal['EndD'][0] !== false) {
         $EndDate += (int) $NewDeal['EndD'][0] * 24 * 60 * 60;
     }
     if ($NewDeal['EndH'][0] !== false) {
         $EndDate += (int) $NewDeal['EndH'][0] * 60 * 60;
     }
     if ($NewDeal['EndM'][0] !== false) {
         $EndDate += (int) $NewDeal['EndM'][0] * 60;
     }
     if ($NewDeal['EndS'][0] !== false) {
         $EndDate += (int) $NewDeal['EndS'][0];
     }
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = false;
     if ($NewDeal['Expiry'][0] !== false) {
         $VExpiry = strtotime(str_ireplace('at', '', $NewDeal['Expiry'][0]));
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Coords = array(0, 0);
     $Locations = array();
     $Address = null;
     $LocURL = FindSubData($Data, 'Participating Locations', '>', 'Click to view locations', false);
     if ($LocURL !== false) {
         $LocURL = FindSubData($LocURL, 'href=', '"', '"', false);
         if ($LocURL !== false) {
             list($SubData, $DURL) = GetWebData($LocURL);
             if ($SubData !== false) {
                 $Start = stripos($SubData, 'class="location"');
                 while ($Start !== false) {
                     $NewAdr = FindData($SubData, chr(9) . 'v_address = "', '"', 14, 0, false, $Start, false);
                     $NewCty = FindData($SubData, chr(9) . 'v_city = "', '"', 11, 0, false, $Start, false);
                     $NewPro = FindData($SubData, chr(9) . 'v_state = "', '"', 12, 0, false, $Start, false);
                     $Address = '';
                     if ($NewAdr !== false) {
                         $Address .= $NewAdr . ', ';
                     }
                     if ($NewCty !== false) {
                         $Address .= $NewCty . ', ';
                     }
                     if ($NewPro !== false) {
                         $Address .= $NewPro . ', ';
                     }
                     $Address = rtrim(trim($Address), ',');
                     $Address = CleanHTML($Address);
                     if ($Address !== '') {
                         $Locations[] = array($Address, 0, 0);
                     }
                     $Start = stripos($SubData, 'class="location"', $Start + 20);
                 }
             }
         }
     } else {
         $Address = '';
         if ($NewDeal['AdrA'][0] !== false) {
             $Address .= $NewDeal['AdrA'][0] . ', ';
             if ($NewDeal['AdrA'][0] == 'Online Vendor') {
                 $Coords = array(-1, -1);
             }
         }
         if ($NewDeal['AdrC'][0] !== false) {
             $Address .= $NewDeal['AdrC'][0] . ', ';
         }
         if ($NewDeal['AdrS'][0] !== false) {
             $Address .= $NewDeal['AdrS'][0] . ', ';
         }
         if ($NewDeal['AdrP'][0] !== false) {
             $Address .= $NewDeal['AdrP'][0] . ', ';
         }
         $Address = rtrim(trim($Address), ',');
         $Address = CleanHTML($Address);
         if ($Address == '') {
             $Address = null;
         }
     }
     if (count($Locations) == 0) {
         $Locations[] = array($Address, $Coords[0], $Coords[1]);
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = 'http://' . $NewDeal['Website'][0];
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'class="side-details"');
     while ($Start !== false) {
         $New = FindData($Data, "&PRODID=", '"', 8, 0, true, $Start, false);
         if ($New !== false && $New > 0) {
             $MoreDeals[] = $New;
         }
         $Start = stripos($Data, 'class="side-details"', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.swarmjam.com/waf.srv/sj/sj/cn/auction_ActionProdDet?ONSUCCESS=swarmofferdet.jsp&PRODID=' . $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = $PriceReg;
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $StoreName;
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #13
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.teambuy.ca/' . $URL, null, 'language=english');
     } else {
         list($Data, $DURL) = GetWebData('http://www.teambuy.ca/' . $URL . '/all-buys/local', null, 'language=english');
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Teambuy.txt", $Data);
     }
     if ($Sub) {
         //if (stripos($Data, '/buy/') === false) return array(true, false);
         $Prices = FindSubData($Data, 'PRICE:', 'class="ddValues">', '<', false);
         if ($Prices == 'Varies') {
             return array(SysLogIt('Deal has variable pricing. Skipping...', StatusInfo), false);
         }
         $NewDeal = array("City" => array('', 'og:url', 'content="http://www.teambuy.ca/', '/', false), "ID" => array(0, 'og:url" content="http://www.teambuy.ca/', '/', '/', true), "Title" => array('', '<title>', '| ', '<', false), "PriceSale" => array(0, 'PRICE:', '$', '<', true), "PriceReg" => array(0, 'VALUE:', '$', '<', true), "StoreName" => array('', 'id="companyName"', '>', '<', false), "Website" => array('', 'id="companyWebsite"', 'href="', '"', false, true), "Description" => array('', 'id="writeUpContent"', '<p>', '</p>', false), "EndDate" => array('', 'var futuredate', '"timercontainer", "', '")', false));
         if (!GetNewDealData($Data, $NewDeal)) {
             return array(SysLogIt('Error finding key deal information.', StatusError), null);
         }
         $StartDate = time();
         $EndDate = strtotime($NewDeal['EndDate'][0] . ' 12:00 AM');
         if ($EndDate === false) {
             return array(SysLogIt('Could not determine deal end date.', StatusError), null);
         }
         //$EndDate += -(((int)$TZ + 5) * 60 * 60);
         //All teambuys seem to finish at 12AM EST
         $VExpiry = FindData($Data, 'id="dealExpiryWide">Expires: ', '<', 29, 0, false, 0, false);
         $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
         if ($VExpiry === false) {
             $VExpiry = 0;
         }
         $Locations = array();
         $Start = stripos($Data, '&geocode');
         while ($Start !== false) {
             $New = FindData($Data, "&hnear=", '&', 7, 0, false, $Start, false);
             if ($New !== false) {
                 $Locations[] = array(CleanHTML(urldecode($New)), 0, 0);
             }
             $Start = stripos($Data, "&geocode", $Start + 20);
         }
         if (count($Locations) == 0) {
             $Locations[] = array(null, 0, 0);
         }
         $RData = array();
         $RData['DRID'] = (int) $NewDeal['ID'][0];
         $RData['Title'] = $NewDeal['Title'][0];
         $RData['Descr'] = $NewDeal['Description'][0];
         $RData['URL'] = 'http://www.teambuy.ca/' . $NewDeal['City'][0] . '/referral/92yyby6y/' . (int) $NewDeal['ID'][0] . '/';
         $RData['Price'] = (double) $NewDeal['PriceSale'][0];
         $RData['Value'] = (double) $NewDeal['PriceReg'][0];
         $RData['Status'] = 0;
         $RData['SDate'] = $StartDate;
         $RData['EDate'] = $EndDate;
         $RData['VDate'] = $VExpiry;
         $RData['StoreName'] = $NewDeal['StoreName'][0];
         $RData['Website'] = $NewDeal['Website'][0];
         $RData['Locations'] = $Locations;
         return array(true, array($RData));
     } else {
         $RData = array();
         $RData['GW'] = true;
         $RData['EDate'] = 0;
         $MoreDeals = array();
         $Last = '';
         $Start = stripos($Data, 'deal_id-');
         while ($Start !== false) {
             $New = FindSubData($Data, 'deal_id-', 'href="http://www.teambuy.ca', '"', false, $Start, false);
             if ($New !== false && $New != $Last) {
                 $MoreDeals[] = $New;
                 $Last = $New;
             }
             $Start = stripos($Data, 'deal_id-', $Start + 20);
         }
         if (count($MoreDeals) > 0) {
             $RData['Deals'] = $MoreDeals;
         }
         return array(true, array($RData));
     }
 }
Example #14
0
function GetNewDealData(&$Data, &$NewDeal)
{
    foreach ($NewDeal as &$NewDealItem) {
        $NewDealItem[0] = FindSubData($Data, $NewDealItem[1], $NewDealItem[2], $NewDealItem[3], $NewDealItem[4]);
        if ($NewDealItem[0] === false) {
            if (count($NewDealItem) < 6) {
                return SysLogIt('Could not find ' . StringAdjust($NewDealItem[1]) . '.', StatusError);
            }
        }
    }
    return true;
}
Example #15
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.ilovemtl.ca/en/' . $URL);
     } else {
         list($Data, $DURL) = GetWebData('http://www.ilovemtl.ca/en/');
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("ILoveMTL.txt", $Data);
     }
     if (stripos($Data, 'og:url') === false) {
         return array(true, false);
     }
     if ($WebD) {
         $NewDeal = array("ID" => array('', 'og:url', 'content="http://www.ilovemtl.ca/en/escapes/', '"', false), "Title" => array('', 'og:title', 'content="', '"', false), "PriceSale" => array(0, 'id="escape-promo-price"', '<span>', '$', true), "PriceReg" => array(0, 'id="escape-promo-regprice"', ':', '$', true), "StoreName" => array('', 'class="location-name', '>', '<', false), "Description" => array('', 'line-height:1.45em;', '>', '<!-- Fine print -->', false), "EndDate" => array('', 'var endtime =', 'new Date(', ')', false));
     } else {
         $NewDeal = array("ID" => array('', 'og:url', 'content="http://www.ilovemtl.ca/en/deal/', '"', false), "Title" => array('', '"promo-title"', '</span>', '</div>', false), "PriceSale" => array(0, 'id="promo-price"', '<span>', '$', true), "PriceReg" => array(0, 'class="price-details', '>Value', '$', true), "StoreName" => array('', 'class="location-name', '>', '<', false), "Description" => array('', 'About this deal', '<p>', '</div>', false), "EndDate" => array('', 'var endtime =', 'new Date(', ')', false), "Address" => array('', 'class="location-addr"', '>', '<a', false, true), "Website" => array('', 'class="location-addr"', '<a href="', '"', false, true));
     }
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     //Start, end dates
     $StartDate = time();
     $EndDate = 0;
     $DateParts = explode(',', $NewDeal['EndDate'][0]);
     if ($DateParts !== false) {
         $EndDate = mktime((int) trim($DateParts[3]), (int) trim($DateParts[4]), (int) trim($DateParts[5]), (int) trim($DateParts[1]) + 1, (int) trim($DateParts[2]), (int) trim($DateParts[0]));
     }
     if ($EndDate === false) {
         $EndDate = 0;
     }
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     //Expiry Date
     $VExpiry = FindSubData($Data, '<li>Valid', ' to ', '</li>', false, 0, false);
     if (stripos($VExpiry, '.') !== false) {
         $VExpiry = substr($VExpiry, 0, stripos($VExpiry, '.'));
     }
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     //Address(es)
     $Locations = array();
     if ($NewDeal['Address'][0] !== false) {
         $Locations[] = array(CleanHTML($NewDeal['Address'][0]), 0, 0);
     } else {
         $Locations[] = array(null, 0, 0);
     }
     /*
     $Start = stripos($Data, '&markers=');
     while ($Start !== false) {
     
       $Coords = FindData($Data, '&markers=', ',greena', 9, 0, false, $Start, false);
       if ($Coords !== false) $Coords = explode(',', $Coords);
       
       $Adr = FindData($Data, '&q=', '&ie=', 3, 0, false, $Start, false);
       $Adr = ($Adr === false)?null:urldecode($Adr);
       
       if (count($Coords) == 2) $Locations[] = array($Adr, $Coords[0], $Coords[1]);
     
       $Start = stripos($Data, '&markers=', $Start + 20);
     }
     */
     //Side deals
     $MoreDeals = array();
     if (!$Sub) {
         $Last = '';
         $Start = stripos($Data, 'class="sidedeal-img"');
         while ($Start !== false) {
             $New = FindData($Data, 'href="http://www.ilovemtl.ca/en/', '"', 32, 0, false, $Start, false);
             if ($New !== false && $New != $Last) {
                 $MoreDeals[] = array($New, stripos($New, 'escapes') !== false);
                 $Last = $New;
             }
             $Start = stripos($Data, 'class="sidedeal-img"', $Start + 20);
         }
     }
     //French title
     if ($WebD) {
         $TitleFR = '';
         list($Data, $DURL) = GetWebData('http://www.ilovemtl.ca/fr/escapades/' . $NewDeal['ID'][0]);
         if ($Data !== false) {
             $TitleFR = FindSubData($Data, 'og:title', 'content="', '"', false, 0, false);
             if ($TitleFR !== false) {
                 $TitleFR = CleanHTML($TitleFR);
             }
         }
     } else {
         $TitleFR = '';
         list($Data, $DURL) = GetWebData('http://www.ilovemtl.ca/fr/deal/' . $NewDeal['ID'][0]);
         if ($Data !== false) {
             $TitleFR = FindSubData($Data, '"promo-title"', '</span>', '</div>', false, 0, false);
             if ($TitleFR !== false) {
                 $TitleFR = CleanHTML($TitleFR);
             }
         }
     }
     //Save
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = CleanHTML($NewDeal['Title'][0]);
     if ($TitleFR !== false && $TitleFR != '') {
         $RData['Title-fr'] = $TitleFR;
     }
     $RData['Descr'] = $NewDeal['Description'][0];
     if ($WebD) {
         $RData['URL'] = 'http://www.ilovemtl.ca/en/escapes/' . $NewDeal['ID'][0];
     } else {
         $RData['URL'] = 'http://www.ilovemtl.ca/en/deal/' . $NewDeal['ID'][0];
     }
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #16
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.dealsnoop.com' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Dealsnoop.txt", 'http://www.dealsnoop.com' . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'coming soon to your city') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'id="deal_id"', 'value="', '"', true), "Title" => array('', 'og:title', 'content="', '"', false), "Website" => array('', 'id="deal-address"', 'href="', '"', false, true), "PriceSale" => array(0, 'id="deal-price"', '$', '<', true), "PriceReg" => array(0, 'id="treat-deal-value"', '$', '<', true), "StoreName" => array('', 'class="caps"', '>', '<', false), "Description" => array('', 'id="about-this-deal"', '>', '</p>', false), "Address" => array('', 'id="googlemap"', 'value="', '"', false, true), "EndY" => array(0, 'id="deal-expyear"', 'value="', '"', true), "EndM" => array(0, 'id="deal-expmonth"', 'value="', '"', true), "EndD" => array(0, 'id="deal-expday"', 'value="', '"', true), "EndH" => array(0, 'id="deal-exphour"', 'value="', '"', true), "EndN" => array(0, 'id="deal-expmin"', 'value="', '"', true), "EndS" => array(0, 'id="deal-expsec"', 'value="', '"', true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = mktime((int) $NewDeal['EndH'][0], (int) $NewDeal['EndN'][0], (int) $NewDeal['EndS'][0], (int) $NewDeal['EndM'][0] + 1, (int) $NewDeal['EndD'][0], (int) $NewDeal['EndY'][0]);
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindSubData($Data, 'id="deal-fp-description"', '<p>', 'expiry', false);
     if ($VExpiry !== false) {
         if (strripos($VExpiry, '.') !== false) {
             $VExpiry = trim(substr($VExpiry, strripos($VExpiry, '.') + 1));
         }
         if ($VExpiry !== false) {
             $VExpiry = strtotime('+' . $VExpiry);
         }
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = $NewDeal['Address'][0];
     }
     $Locations = array();
     $Locations[] = array($Address, 0, 0);
     $MoreDeals = array();
     $Start = stripos($Data, 'class="more-deals-link"');
     while ($Start !== false) {
         $ID = FindData($Data, '../treats/?dsdeal=', "'", 18, 0, true, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = '/treats/?dsdeal=' . $ID;
         }
         $Start = stripos($Data, 'class="more-deals-link"', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.dealsnoop.com/treats/?dsdeal=' . (int) $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #17
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.everybodybuys.com/deals.xml', null, null, 180);
     if ($Data === false) {
         return array(SysLogIt('Error getting XML data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("EverybodyBuys.txt", $Data);
     }
     //Convert XML to string and then decode into array
     $XMLArray = json_decode(json_encode((array) simplexml_load_string($Data)), true);
     if (array_key_exists("item", $XMLArray) === false) {
         return array(SysLogIt('XML data structure not as anticipated.', StatusError), null);
     }
     //Create deals array
     $RData = array();
     foreach ($XMLArray["item"] as $ItemEntry) {
         //Reset flag and reinitialize array
         $Webdeal = false;
         $ADeal = array();
         //Save basic data
         $ADeal['DRID'] = $ItemEntry["id"];
         $ADeal['Title'] = $ItemEntry["title"];
         $ADeal['Descr'] = $ItemEntry["description"];
         $ADeal['URL'] = $ItemEntry["url"];
         $ADeal['Country'] = $ItemEntry["market_country"];
         $ADeal['Price'] = (double) $ItemEntry["price"];
         $ADeal['Value'] = (double) $ItemEntry["value"];
         $ADeal['Status'] = 0;
         $ADeal['SDate'] = strtotime($ItemEntry["starting_time"]);
         $ADeal['EDate'] = strtotime($ItemEntry["ending_time"]);
         $ADeal['VDate'] = 0;
         if (array_key_exists("restrictions", $ItemEntry)) {
             if (stripos($ItemEntry["restrictions"], 'Expires') !== false) {
                 $VDate = FindSubData($ItemEntry["restrictions"], 'Expires', ' ', '|', false);
                 if ($VDate !== false) {
                     $VDate = strtotime($VDate);
                     if ($VDate !== false) {
                         $ADeal['VDate'] = $VDate;
                     }
                 }
             }
         }
         $ADeal['StoreName'] = $ItemEntry["merchant"];
         //Ensure URL is present
         if (array_key_exists("merchant_url", $ItemEntry)) {
             $ADeal['Website'] = $ItemEntry["merchant_url"];
         } else {
             $ADeal['Website'] = null;
         }
         /*
         //If more than 10 regions, likely web deal
         if (count($ItemEntry["regionAvailability"]) > 10) $Webdeal = true;
         
         //Check if USA is listed in regions, but source is Canada
         foreach ($ItemEntry["regionAvailability"] as $Region) {
           if (($Region == 'USA') && ($ItemEntry["market_country"] == 'Canada')) {
             //Set as webdeal
             $Webdeal = true;
             //Set country to none (available anywhere)
             $ADeal['Country'] = false;
             break;
           }
         }
         */
         $Locations = array();
         if (count($ItemEntry["locations"]) == 0) {
             //No locations, treat as address-less webdeal
             $Locations[] = array(null, -1, -1);
         } else {
             //Add each address to the locations array
             foreach ($ItemEntry["locations"] as $Location) {
                 //Piece together address bits
                 $Address = '';
                 if (array_key_exists("address", $Location)) {
                     if ($Location["address"] != 'N/A') {
                         $Address .= $Location["address"] . ', ';
                     }
                 }
                 if (array_key_exists("city", $Location)) {
                     if ($Location["city"] != 'N/A') {
                         $Address .= $Location["city"] . ', ';
                     }
                 }
                 if (array_key_exists("state", $Location)) {
                     if ($Location["state"] != 'N/A') {
                         $Address .= $Location["state"] . ', ';
                     }
                 }
                 if (array_key_exists("zip", $Location)) {
                     if ($Location["zip"] != 'N/A') {
                         $Address .= $Location["zip"] . ', ';
                     }
                 }
                 if (array_key_exists("phone", $Location)) {
                     if ($Location["phone"] != 'N/A') {
                         $Address .= $Location["phone"] . ', ';
                     }
                 }
                 //Remove trailing comma and space
                 if ($Address == '') {
                     $Address = null;
                 } else {
                     $Address = substr($Address, 0, -2);
                 }
                 //$Address = str_ireplace(', Array', '', $Address);
                 if ($Webdeal) {
                     //If previously flagged as webdeal, put -1, -1 as coordinates
                     $Locations[] = array($Address, -1, -1);
                 } elseif (array_key_exists("latitude", $Location) && array_key_exists("longitude", $Location)) {
                     //Check if coordinates are listed
                     $Locations[] = array($Address, (double) $Location["latitude"], (double) $Location["longitude"]);
                 } else {
                     //Otherwise, put 0, 0 to trigger geolocation
                     $Locations[] = array($Address, 0, 0);
                 }
             }
         }
         //Save locations
         $ADeal['Locations'] = $Locations;
         //Add deal to array
         $RData[] = $ADeal;
     }
     return array(true, $RData);
 }
Example #18
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.citylinked.com/todays-deal.php?' . $URL);
     } else {
         list($Data, $DURL) = GetWebData('http://www.citylinked.com/todays-deal.php?city=' . $URL);
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Vieurbaine.txt", $Data);
     }
     if (stripos($Data, 'og:url') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'og:url', '?deal=', '&', true), "Title" => array('', 'og:title', 'content="', '"/', false), "PriceSale" => array(0, 'itemprop="price"', '>', '$', true), "PriceReg" => array(0, 'line-through', '>', '$', true), "StoreName" => array('', 'var marker = createMarker(', 'point,"', '"', false), "Address" => array('', 'div id=\\"gmapmarker\\"', '<br \\/>', '<\\/div>', false), "Coords" => array('', 'var point = new GLatLng', '(', ')', false), "Website" => array('', 'itemprop="url"', 'href="', '"', false, true), "Description" => array('', 'og:description', 'content="', '"/>', false), "EndH" => array(0, 'id="hours"', '>', '<', true, true), "EndM" => array(0, 'id="mins"', '>', '<', true, true), "EndS" => array(0, 'id="secs"', '>', '<', true, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     //Start, end dates
     $StartDate = time();
     $EndDate = time();
     if ($NewDeal['EndH'][0] !== false) {
         $EndDate += (int) $NewDeal['EndH'][0] * 60 * 60;
     }
     if ($NewDeal['EndM'][0] !== false) {
         $EndDate += (int) $NewDeal['EndM'][0] * 60;
     }
     if ($NewDeal['EndS'][0] !== false) {
         $EndDate += (int) $NewDeal['EndS'][0];
     }
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     //Expiry Date
     $VExpiry = FindData($Data, 'Promotional value expires', '</p>', 26, 0, false, 0, false);
     if ($VExpiry !== false) {
         if (stripos($VExpiry, ',') !== false) {
             $VExpiry = substr($VExpiry, 0, stripos($VExpiry, ','));
         }
         $VExpiry = strtotime(CleanHTML($VExpiry));
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     //Website
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     //Address
     $Address = $NewDeal['Coords'][0];
     if (stripos($Address, ',') !== false) {
         $Address = explode(',', $Address);
     }
     if ($Address === false || count($Address) != 2) {
         $Address = array(0, 0);
     }
     $Locations = array();
     $Locations[] = array(CleanHTML($NewDeal['Address'][0]), $Address[0], $Address[1]);
     $MoreDeals = array();
     if (stripos($Data, '?pagetype=sidedeal') !== false) {
         $MoreDeals[] = "pagetype=sidedeal";
     }
     $TitleFR = false;
     list($Data, $DURL) = GetWebData('http://www.vieurbaine.com/offre-du-jour.php?deal=' . (int) $NewDeal['ID'][0]);
     if ($Data !== false) {
         $TitleFR = FindSubData($Data, 'og:title', 'content="', '"', false);
         if ($TitleFR !== false) {
             $TitleFR = ucfirst(strtolower(CleanHTML($TitleFR)));
         }
     }
     //Save
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = ucfirst(strtolower(CleanHTML($NewDeal['Title'][0])));
     if ($TitleFR !== false && $TitleFR != '') {
         $RData['Title-fr'] = $TitleFR;
     }
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.citylinked.com/todays-deal.php?deal=' . (int) $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #19
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://toronto.fabfind.com/' . $URL, null, 'Preferences=Town=M2');
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("FabFind.txt", $Data);
     }
     if (stripos($Data, 'Chatter.aspx?dealid=') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'Chatter.aspx?dealid', '=', '"', true), "Title" => array('', 'id="ctl00_contentTop_lblTitle"', '>', '</span', false), "PriceSale" => array(0, 'ctl00_contentTop_lblPrice', '>', '<', true), "PriceReg" => array(0, 'ctl00_contentTop_lblValue', '$', '<', true), "StoreName" => array('', 'ctl00_contentMain_lblBusinessName', '>', '<', false), "Website" => array('', 'linkBusinessWebsite', 'href="', '"', false, true), "Phone" => array('', 'ctl00_contentMain_lblPhone', 'Phone: ', '<', false, true), "Address" => array('', 'ctl00_contentMain_lblAddress', '>', '</span', false, true), "Description" => array('', 'ctl00_contentMain_lblDescription', '>', '</span>', false), "Coords" => array('', 'GMaps', 'GLatLng(', ')', false, true), "EndDate" => array(0, 'DealSecLeft', '+', "'", true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = time() + $NewDeal['EndDate'][0];
     //End date uses seconds left, so no Timezone calculations needed
     $VExpiry = FindSubData($Data, 'Certificate expires', '(', ')', false);
     if ($VExpiry === false) {
         $VExpiry = FindSubData($Data, '<li>Expires', ' ', '<', false);
     }
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = $NewDeal['Address'][0] === false ? '' : trim(str_ireplace('<br />', ', ', $NewDeal['Address'][0]));
     if (stripos($Address, 'several locations') !== false) {
         $Address = array();
         $Start = stripos($Data, '&hnear=');
         while ($Start !== false) {
             $New = FindData($Data, '&hnear=', '&', 7, 0, false, $Start, false);
             if ($New !== false) {
                 $Address[] = array(str_ireplace('+', ' ', $New), 0, 0);
             }
             $Start = stripos($Data, '&hnear=', $Start + 20);
         }
     }
     if (!is_array($Address)) {
         $Address = array(array($Address, 0, 0));
     }
     foreach ($Address as &$Adr) {
         if ($NewDeal['Phone'][0] !== false) {
             $Adr[0] .= $NewDeal['Phone'][0];
         }
         if ($Adr[0] == '') {
             $Adr[0] = null;
         }
     }
     /*
     $Coords = array(0, 0);
     if ($NewDeal['Coords'][0] !== false) $Coords = explode(',', $NewDeal['Coords'][0]);
     if (($Coords === false) || (count($Coords) != 2)) $Coords = array(0, 0);
     */
     $MoreDeals = array();
     $Start = stripos($Data, 'href="deal/');
     while ($Start !== false) {
         $New = FindData($Data, 'href="deal/', '"', 11, 0, false, $Start, false);
         if ($New !== false) {
             $MoreDeals[] = '/deal/' . $New;
         }
         $Start = stripos($Data, 'href="deal/', $Start + 20);
     }
     $Title = CleanHTML($NewDeal['Title'][0]);
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $Title;
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://toronto.fabfind.com/Default.aspx?DealID=' . (int) $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $NewDeal['Website'][0];
     $RData['Locations'] = $Address;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #20
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.dealathons.com/?city=' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Dealathons.txt", $Data);
     }
     if (stripos($Data, '/checkout/') === false || stripos($Data, 'Dealathons Is Coming') !== false || stripos($Data, 'No Deal Available') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, '/checkout/', '/product/', '/', true), "Title" => array('', 'class="cont_top_cntr"', '<p>', '</p>', false), "PriceSale" => array(0, 'class="price_value"', '$', '<', true), "PriceReg" => array(0, '>Value<', '$', '<', true), "Description" => array('', 'class="highlights"', '>', '<!', false), "Coords" => array('', 'maps.google.ca', ';ll=', '&', false, true), "StartDate" => array('', 'var startdate =', '"', '";', false), "EndDate" => array('', 'var targetdate =', '"', '";', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = strtotime($NewDeal['StartDate'][0]);
     $EndDate = strtotime($NewDeal['EndDate'][0]);
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindSubData($Data, '"bottom_description"', 'Expires ', '<', false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = array();
     $AdrBlock = FindData($Data, '<address>', '</address>', 9, 0, false, 0, false);
     if ($AdrBlock !== false) {
         if (stripos($AdrBlock, '<p>&nbsp;</p>') === false) {
             if (stripos($AdrBlock, '<br />') !== false) {
                 $AdrBlock = substr($AdrBlock, stripos($AdrBlock, '<br />') + 6);
             } elseif (stripos($AdrBlock, '</p>') !== false) {
                 $AdrBlock = substr($AdrBlock, stripos($AdrBlock, '</p>') + 6);
             }
             $AdrBlock = array($AdrBlock);
         } else {
             $AdrBlock = explode('<p>&nbsp;</p>', $AdrBlock);
         }
         foreach ($AdrBlock as &$Adr) {
             $Adr = CleanHTML($Adr);
             if ($Adr != '') {
                 $Address[] = $Adr;
             }
         }
     }
     if (count($Address) == 0) {
         $Address[] = null;
     }
     $Locations = array();
     if (count($Address) == 1) {
         if ($NewDeal['Coords'][0] !== false) {
             $Coords = explode(',', $NewDeal['Coords'][0]);
             if ($Coords === false || count($Coords) != 2) {
                 $Coords = array(0, 0);
             }
         } else {
             $Coords = array(0, 0);
         }
         $Locations[] = array($Address[0], $Coords[0], $Coords[1]);
     } else {
         foreach ($Address as $Adr) {
             $Locations[] = array($Adr, 0, 0);
         }
     }
     if (count($Locations) == 0) {
         return array(SysLogIt("Could not decipher addresses for division with ID of " . $SRID . ".", StatusError), null);
     }
     $StoreName = false;
     if (stripos($Data, 'pp-headline-address') !== false) {
         $StoreName = FindSubData($Data, 'pp-headline-address', '>', '<', false);
     } elseif (stripos($Data, '<address>') !== false) {
         $StoreName = FindData($Data, '<address>', '</address>', 9, 0, false, 0, false);
         if ($StoreName !== false) {
             if (stripos($StoreName, '<span') === false) {
                 $StoreName = false;
             } else {
                 $StoreName = FindData($StoreName, '<span', '</span>', 5, 0, false, 0, false);
                 if ($StoreName !== false) {
                     $StoreName = substr($StoreName, stripos($StoreName, '>') + 1);
                     $StoreName = CleanHTML($StoreName);
                 }
             }
         }
     }
     if ($StoreName === false) {
         return array(SysLogIt("Could not determine store name for division with ID of " . $SRID . ".", StatusError), null);
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.dealathons.com/?city=' . $URL;
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceReg'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $StoreName;
     $RData['Website'] = null;
     $RData['Locations'] = $Locations;
     return array(true, array($RData));
 }
Example #21
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.tuango.ca/en/deal/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Tuango.txt", 'http://www.tuango.ca/en/deal/' . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if ($Sub) {
         if (stripos($Data, 'purchase?') === false) {
             return array(true, false);
         }
         $NewDeal = array("ID" => array('', 'class="dealName"', '/en/', '"', false), "Title" => array('', 'class="dealName"', '>', '</p>', false), "PriceSale" => array(0, 'class="dealPrice"', '$', '<', true), "PriceReg" => array(0, 'class="infoNumbers"', '$', '<', true), "StoreName" => array('', 'companyName', '<h2>', '</h2>', false), "Address" => array('', 'companyName', '</h2>', '<', false, true), "Website" => array('', 'companyName', 'href="', '"', false, true), "Description" => array('', 'companyDetails', '<p>', '</div>', false), "EndDate" => array('', 'TargetDate =', '"', '"', false));
         if (!GetNewDealData($Data, $NewDeal)) {
             return array(SysLogIt('Error finding key deal information.', StatusError), null);
         }
         $StartDate = time();
         $EndDate = strtotime($NewDeal['EndDate'][0]);
         if ($EndDate === false) {
             return array(SysLogIt('Could not determine deal end date.', StatusError), null);
         }
         $VExpiry = FindSubData($Data, '/ Ends', ' ', '<', false);
         if ($VExpiry !== false) {
             $VExpiry = strtotime($VExpiry);
         }
         if ($VExpiry === false) {
             $VExpiry = 0;
         }
         $Website = null;
         if ($NewDeal['Website'][0] !== false) {
             $Website = $NewDeal['Website'][0];
         }
         $Locations = array();
         $Address = null;
         if ($NewDeal['Address'][0] !== false) {
             $Address = $NewDeal['Address'][0];
         }
         if (stripos($Address, 'website') !== false) {
             $Locations[] = array(null, -1, -1);
         } else {
             $Locations[] = array($Address, 0, 0);
         }
         $TitleFR = false;
         list($Data, $DURL) = GetWebData('http://www.tuango.ca/fr/' . $NewDeal['ID'][0]);
         if ($Data !== false) {
             $TitleFR = FindSubData($Data, 'class="dealName"', '</span>', '</p>', false);
             if ($TitleFR !== false) {
                 $TitleFR = CleanHTML($TitleFR);
             }
         }
         $RData = array();
         $RData['DRID'] = $NewDeal['ID'][0];
         $RData['Title'] = CleanHTML(str_ireplace("Today's Deal:", "", $NewDeal['Title'][0]));
         if ($TitleFR !== false && $TitleFR != '') {
             $RData['Title-fr'] = $TitleFR;
         }
         $RData['Descr'] = $NewDeal['Description'][0];
         $RData['URL'] = 'http://www.tuango.ca/en/' . $NewDeal['ID'][0];
         $RData['Price'] = (double) $NewDeal['PriceSale'][0];
         $RData['Value'] = (double) $NewDeal['PriceReg'][0];
         $RData['Status'] = 0;
         $RData['SDate'] = $StartDate;
         $RData['EDate'] = $EndDate;
         $RData['VDate'] = $VExpiry;
         $RData['StoreName'] = $NewDeal['StoreName'][0];
         $RData['Website'] = $Website;
         $RData['Locations'] = $Locations;
         return array(true, array($RData));
     } else {
         $RData = array();
         $RData['GW'] = true;
         $RData['EDate'] = 0;
         $MoreDeals = array();
         $Start = stripos($Data, 'class="gbItemInfo"');
         while ($Start !== false) {
             $ID = FindData($Data, "div", "href='/en/deal", "'", false, $Start, false);
             if ($ID !== false) {
                 $MoreDeals[] = $ID;
             }
             $Start = stripos($Data, 'class="gbItemInfo"', $Start + 20);
         }
         if (count($MoreDeals) > 0) {
             $RData['Deals'] = $MoreDeals;
         }
         return array(true, array($RData));
     }
 }
Example #22
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.groupon.ca/' . $URL, null, 'user_locale=en_CA');
     //fr_CA
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("GrouponCA.txt", $Data);
     }
     if (stripos($Data, '/payment') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', 'http://www.facebook.com/share.php', '?u=http://www.groupon.ca', '"', false), "Title" => array('', 'id="contentDealTitle"', '<h1>', '</h1>', false), "PriceSale" => array(0, 'class="price"', 'C$', '<', true), "Savings" => array(0, 'class="row2"', 'C$', '<', true), "StoreName" => array('', 'class="merchantContact"', '">', '<', false), "Website" => array('', 'class="merchantContact"', 'href="', '"', false, true), "Description" => array('', 'class="merchantContact"', '<p><p>', '<p class="outset"', false), "EndDate" => array('', 'id="currentTimeLeft"', 'value="', '"', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     //Start, end dates
     $StartDate = time();
     $EndDate = time();
     $EndDate += (int) $NewDeal['EndDate'][0] / 1000;
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     //Store name
     $StoreName = CleanHTML($NewDeal['StoreName'][0]);
     //Expiry Date
     $VExpiry = FindData($Data, '<li>Expires', '<', 11, 0, false, 0, false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     //Address(es)
     if (stripos($Data, '<strong>Locations') === false && stripos($Data, 'locations:</strong>') === false) {
         $Addresses = FindSubData($Data, 'class="merchantContact"', '</h', '<br />', false, 0, false);
         if ($Addresses !== false) {
             $Addresses = array($Addresses);
         }
         if ($Addresses === false) {
             $Addresses = array();
         }
     } else {
         $Addresses = FindSubData($Data, '<strong>Locations', '</strong>', '<p', false, 0, false);
         if ($Addresses === false) {
             $Addresses = FindSubData($Data, 'locations:</strong>', '</p>', '<p', false, 0, false);
         }
         if ($Addresses !== false) {
             $Addresses = explode('<br /><br />', $Addresses);
         }
         if ($Addresses === false) {
             $Addresses = array();
         }
     }
     $Locations = array();
     foreach ($Addresses as &$Adr) {
         if (!is_null($Adr) && $Adr != '') {
             $Locations[] = array(CleanHTML($Adr), 0, 0);
         }
     }
     if (count($Locations) == 0) {
         $Locations[] = array(null, 0, 0);
     }
     //Side deals
     $Last = $NewDeal['ID'][0];
     $MoreDeals = array();
     $Start = stripos($Data, '"/deals/');
     while ($Start !== false) {
         $New = FindData($Data, '"/deals/', '"', 1, 0, false, $Start, false);
         if ($New !== false && $New != $Last) {
             $MoreDeals[] = $New;
             $Last = $New;
         }
         $Start = stripos($Data, '"/deals/', $Start + 20);
     }
     $TitleFR = '';
     list($Data, $DURL) = GetWebData('http://www.groupon.ca/' . $URL, null, 'user_locale=fr_CA');
     if ($Data !== false) {
         $TitleFR = FindSubData($Data, 'id="contentDealTitle"', '<h1>', '</h1>', false, 0, false);
         if ($TitleFR !== false) {
             $TitleFR = CleanHTML($TitleFR);
         }
     }
     //Save
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = CleanHTML($NewDeal['Title'][0]);
     if ($TitleFR !== false && $TitleFR != '') {
         $RData['Title-fr'] = $TitleFR;
     }
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.groupon.ca' . $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) $NewDeal['PriceSale'][0] + (double) $NewDeal['Savings'][0];
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $StoreName;
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
Example #23
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.livingsocial.com/cities/' . $URL, null, 'seen-roadblock=1');
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("LivingSocial.txt", "http://www.livingsocial.com/cities/" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'More Cities - LivingSocial') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'og:url', '/deals/', '-', true), "Title" => array('', 'class="deal-title"', '<p>', '</p>', false), "Website" => array('', 'id="sfwt_full_1"', 'href="', '"', false), "PriceSale" => array('', 'class="deal-price', '</span>', '</div>', false), "PercOff" => array(0, 'id="percentage"', '>', '%', true), "StoreName" => array('', 'class="deal-title"', '<h1>', '</h1>', false), "Description" => array('', 'id="sfwt_full_1"', '<p>', '</p>', false), "Address" => array('', '<span class="street_1"', '>', '|', false, true), "Phone" => array('', 'class="phone"', '>', '<', false, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $VExpiry = FindData($Data, 'expires on ', '</p>', 11, 3, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Expiry = FindData($Data, '<div id="countdown">', '</div>', 20, 0, false, 0, false);
     if ($Expiry === false) {
         SysLogIt('No countdown timer found. Switching to secondary detection.');
         $Days = FindSubData($Data, '<li class="last">', '<div class="value">', 'day', true);
         if ($Days === false) {
             $Days = 0;
         }
         $EndDate = mktime(5 - ($TZ + 5), 0, 0, date('n'), date('j') + (date('H') > 5 - ($TZ + 5) ? 1 : 0) + $Days, date('Y'));
     } else {
         $ExpParts = explode('<span class="colon">:</span>', $Expiry);
         foreach ($ExpParts as &$ExpPart) {
             $ExpPart = FindData($ExpPart, '<span class="num">', '</span>', 18, 0, true);
         }
         if ($ExpParts[0] === false || $ExpParts[1] === false || $ExpParts[2] === false) {
             $EndDate = mktime(5 - ($TZ + 5), 0, 0, date('n'), date('j') + (date('H') > 5 - ($TZ + 5)) ? 1 : 0, date('Y'));
         } else {
             $EndDate = mktime(date('H') + $ExpParts[0], date('i') + $ExpParts[1], date('s') + $ExpParts[2], date('n'), date('j'), date('Y'));
         }
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     //if ($NewDeal['Phone'][0] !== false) $Address .= $NewDeal['Phone'][0];
     if ($Address == '') {
         $Address = null;
     }
     $Coords = FindData($Data, 'maps?q=', '"', 7, 0, false, 0, false);
     if ($Coords !== false) {
         $Coords = explode(',', $Coords);
         if ($Coords === false || count($Coords) != 2) {
             $Coords = array(0, 0);
         }
     } else {
         $Coords = array(0, 0);
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0] . ' - ' . $NewDeal['StoreName'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.livingsocial.com/deals/' . $NewDeal['ID'][0];
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) ($NewDeal['PriceSale'][0] / (1 - $NewDeal['PercOff'][0] / 100));
     $RData['Status'] = 0;
     $RData['SDate'] = $StartDate;
     $RData['EDate'] = $EndDate;
     $RData['VDate'] = $VExpiry;
     $RData['StoreName'] = $NewDeal['StoreName'][0];
     $RData['Website'] = $NewDeal['Website'][0];
     $RData['Locations'] = array(array($Address, $Coords[0], $Coords[1]));
     return array(true, array($RData));
 }