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 Groupon divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.groupon.com'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("GrouponCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, "id='subscription_division_id'", '>', '</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) { $ID = FindSubData($DataItem, "value=", "'", "'", false); $Name = FindSubData($DataItem, 'value=', '>', '<', false); if ($Name !== false && $ID !== false) { if (!CheckURL('Groupon', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Groupon', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new Dealsnoop divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.dealsnoop.com/'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("DealsnoopCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="city-rollover"', '<ul>', '</div>' . chr(13) . chr(10), false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } //Parse contents of city box $DataArray = str_ireplace('</ul>', '</li>', $DataArray); $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('Dealsnoop', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Dealsnoop', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new DealFind divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.dealfind.com/'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("DealFindCity.txt", $Data); } SysLogIt('Parsing HTML.'); if (!($DataArray = FindData($Data, ' - Select your city - </option>', '</select>', 31, 0, false))) { return SysLogIt("Couldn't find city content.", StatusError); } //Parse contents of city box $DataArray = explode('</option>', $DataArray); foreach ($DataArray as $DataItem) { $DataItem = trim(str_ireplace(' selected="selected"', '', $DataItem)); if (stripos($DataItem, '<option value="') !== false) { $ID = FindData($DataItem, '<option value="', '">', 15, 0, false); $StartPos = stripos($DataItem, '">'); if ($StartPos !== false && $ID !== false) { $Name = substr($DataItem, $StartPos + 2); if ($Name != 'test') { if (!CheckURL('DealFind', $SID, $Name, $ID)) { return false; } } } } } return UpStatus('DealFind', $SID); }
public function GetNewDivisions($SID) { SysLogIt('Checking for new Teambuy divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.teambuy.ca/'))) { return SysLogIt('Error getting web data.', StatusError); } //file_put_contents("Teambuy.txt", $Data); SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="cityBoxFancyAP"', '<table>', '</table>', false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } //Large Centres $DataArray = explode('</td>', $DataArray); foreach ($DataArray as $DataItem) { if (stripos($DataItem, 'otherCity') !== false) { $ID = FindData($DataItem, 'change-to-', '"', 10, 0, false, 0, false); $Name = FindSubData($DataItem, '<span><a', '>', '<', false); if ($Name !== false && $ID !== false) { if (!CheckURL('Teambuy', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Teambuy', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new Tuango divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.tuango.ca/en/deal/montreal/'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("TuangoCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="merchantCategoriesDropDownBox"', '>', '<div style', false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } //Parse contents of city box $DataArray = explode('</div>', $DataArray); foreach ($DataArray as $DataItem) { if (stripos($DataItem, 'selectCategory(') !== false) { $ID = FindSubData($DataItem, 'selectCategory(', ", '", "'", false); $Name = FindSubData($DataItem, 'class="categoryNameV2"', '>', '<', false); if ($Name !== false && $ID !== false) { if (!CheckURL('Tuango', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Tuango', $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); }
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); }
public function GetNewDivisions($SID) { SysLogIt('Checking for new Groupon Canada divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.groupon.ca/', null, 'user_locale=en_CA'))) { return SysLogIt('Error getting web data.', StatusError); } //file_put_contents("Groupon Canada.txt", $Data); SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="citySelectBox"', '<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="http://www.groupon.ca', '"', 27, 0, false, 0, false); $Name = FindSubData($DataItem, 'href=', '>', '<', false); if ($Name !== false && $ID !== false) { if ($Name == '') { $Name = ucwords($ID); } if (!CheckURL('Groupon Canada', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Groupon Canada', $SID); }
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); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new Dealicious divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.dealicious.ca'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("DealiciousCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="MyCity"', '>', '</select>', false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } $DataArray = explode('/option', $DataArray); foreach ($DataArray as $DataItem) { if (stripos($DataItem, '"IntroMyCityOptions"') !== false) { $ID = FindSubData($DataItem, 'value=', '"', '"', false); $Name = FindSubData($DataItem, 'value=', '>', '<', false); if ($Name !== false && $ID !== false) { if (!CheckURL('Dealicious', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Dealicious', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new SwarmJam divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.swarmjam.com'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("SwarmJamCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'id="subscriptionselector"', '>', '</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) { $ID = FindData($DataItem, 'value="', '"', 7, 0, true); $Name = FindSubData($DataItem, 'value="', '>', '<', false); //$Name = CleanHTML($Name); if ($Name !== false && $ID !== false) { if (!CheckURL('SwarmJam', $SID, $Name, $ID)) { return false; } } } } return UpStatus('SwarmJam', $SID); }
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); }
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); }
function CheckForNewDivisions($ST) { //Read deal sources once a week list($QR, $RS, $T) = QuerySet('SELECT DealSourceID AS ID, DealSourceName AS DN, DealSourceFileName AS FN FROM 4100_Deal_Sources WHERE DealSourceStatus & 1 = 1 AND UNIX_TIMESTAMP(URLsLastUpdated) < ' . mktime(date('H'), date('i'), date('s'), date('n'), date('j') - 7, date('Y')) . ';'); if ($QR < 0) { return SysLogIt('Query returned an error.', StatusError, ActionSelect); } if ($QR > 0) { while ($DR = mysql_fetch_array($RS)) { if (time() - $ST > 720) { return SysLogIt('Division parsing exceeded 12 minutes; stopping until next cycle.', StatusInfo, ActionNotSpecified, -1); } try { SysLogIt('Retrieving ' . $DR['DN'] . ' divisions.', StatusInfo, ActionNotSpecified, 1); $AClass = $DR['FN']; $TheClass = new $AClass(); $TheClass->GetNewDivisions($DR['ID']); SysLogIt('Finished retrieving ' . $DR['DN'] . ' divisions.', StatusInfo, ActionNotSpecified, -1); } catch (Exception $Exp) { SysLogIt('Error getting divisions for source with ID of ' . $DR['ID'] . '.', StatusError); UpStatus($DR['DN'], $DR['ID']); } } } return true; }
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); }
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, ' ') !== false) { $Name = substr($Name, 0, stripos($Name, ' ')); } if (!CheckURL('DealTicker', $SID, $Name, $ID)) { return false; } } } } return UpStatus('DealTicker', $SID); }
public function GetNewDivisions($SID) { SysLogIt('Checking for new Vieurbaine / Citylinked divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.citylinked.com/todays-deal.php?city=Montreal'))) { return SysLogIt('Error getting web data.', StatusError); } //file_put_contents("Vieurbaine.txt", $Data); SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'class="tdropdown"', '<ul>', '</ul>', false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } //Large Centres $DataArray = explode('</li>', $DataArray); if (!CheckURL('Vieurbaine / Citylinked', $SID, 'Montreal', 'Montreal')) { return false; } foreach ($DataArray as $DataItem) { if (stripos($DataItem, 'href=') !== false) { $ID = FindSubData($DataItem, 'href=', '?city=', '"', false); $Name = FindSubData($DataItem, 'href=', '>', '<', false); if ($Name !== false && $ID !== false) { if ($Name == '') { $Name = $ID; } if (!CheckURL('Vieurbaine / Citylinked', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Vieurbaine / Citylinked', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new Dealathons divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.dealathons.com/?city=13'))) { return SysLogIt('Error getting web data.', StatusError); } if ($DebugMode) { file_put_contents("DealathonsCity.txt", $Data); } SysLogIt('Parsing HTML.'); $DataArray = FindSubData($Data, 'class="city_select"', '>', '</select', false); if ($DataArray === false) { return SysLogIt("Couldn't find city content.", StatusError); } //Large Centres $DataArray = explode('</option>', $DataArray); foreach ($DataArray as $DataItem) { if (stripos($DataItem, 'value=') !== false) { $ID = stripos($DataItem, 'value=""') === false ? FindSubData($DataItem, 'value=', '"', '"', false) : '13'; $Name = substr($DataItem, stripos($DataItem, '>') + 1); if ($Name !== false && $ID !== false) { if (!CheckURL('Dealathons', $SID, $Name, $ID)) { return false; } } } } return UpStatus('Dealathons', $SID); }
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); }
public function GetNewDivisions($SID) { global $DebugMode; if (!CheckURL('EverybodyBuys', $SID, 'XML', 'XML')) { return false; } return UpStatus('EverybodyBuys', $SID); }
public function GetNewDivisions($SID) { global $DebugMode; SysLogIt('Checking for new LivingSocial divisions.'); if (!(list($Data, $DURL) = GetWebData('http://www.livingsocial.com/'))) { return SysLogIt('Error getting web data.', StatusError); } SysLogIt('Parsing HTML.'); if ($DebugMode) { file_put_contents("LivingSocialCity.txt", $Data); } //Using script /* if (!$DataArray = FindSubData($Data, '<body', '<script src="', '"', false, 0, false)) { return SysLogIt("Couldn't find script link.", StatusError); } if (!list ($Data, $DURL) = GetWebData($DataArray)) { return SysLogIt('Error getting script.', StatusError); } SysLogIt('Parsing Javascript.'); if (!$DataArray = FindData($Data, 'dls.fte_cities =', ';', 17, 0, false)) { return SysLogIt("Couldn't find script data.", StatusError); } $DataArray = json_decode($DataArray, true); if (!is_null($DataArray)) { $Output = ''; foreach ($DataArray as $DataItem) { foreach ($DataItem as $SubDataItem) { if (!CheckURL('LivingSocial', $SID, $SubDataItem['name'], (int)$SubDataItem['id'], GetCountry($SubDataItem['country']))) return false; $Output .= $SubDataItem['id'].': '.$SubDataItem['name'].chr(13).chr(10); } } if ($DebugMode) file_put_contents("LivingSocialCity.txt", $Output); } else { return SysLogIt('Error parsing data from script.', StatusError); } */ //Using in-line data if (!($DataArray = FindSubData($Data, "id='city_picker'", '>', '</select>', false))) { return SysLogIt("Couldn't find city content.", StatusError); } //Parse contents of city box $DataArray = explode('<option', $DataArray); foreach ($DataArray as $DataItem) { $DataItem = trim(str_ireplace(' selected=selected', '', $DataItem)); if (stripos($DataItem, 'data-lang=') !== false) { $ID = FindData($DataItem, 'value="', '"', 7, 0, true); $Name = FindSubData($DataItem, 'value="', '>', '<', false); if ($Name !== false && $ID !== false) { if ($Name != 'test') { if (!CheckURL('LivingSocial', $SID, $Name, (int) $ID)) { return false; } } } } } return UpStatus('LivingSocial', $SID); }
public function GetNewDivisions($SID) { CheckURL('ILoveMTL', $SID, 'Montreal', 'Montreal'); return UpStatus('ILoveMTL', $SID); }