コード例 #1
0
ファイル: WagJag.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     //$TrueURL = (is_numeric($URL)?'?_page=home&city='.$URL:$URL);
     list($Data, $DURL) = GetWebData('http://www.wagjag.com' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("WagJag.txt", "http://www.wagjag.com/" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'id="js_wagjag_id"') === false || stripos($Data, 'error with that wagjag') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'id="js_wagjag_id"', 'value="', '"', true), "Title" => array('', 'id="deal_headline"', '>', '</span>', false), "Website" => array('', '<br /><br /></p>', 'href="', '"', false, true), "PriceReg" => array(0, 'Regular Price:', '$', '<', true), "PriceSale" => array(0, 'Buy For', '$', '<', true), "StoreName" => array('', '<!-- <h1>About', ' ', '<', false), "Description" => array('', '<!-- Deal Highlights -->', 'Highlights</span>', '<!-- End Deal Information -->', false), "Addresses" => array('', 'var sites =', '[[', ']]', false, true), "EndDate" => array('', 'TargetDate = ', '"', 'GMT', 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);
     }
     //Wagjags all seem to finish at midnight EST
     $VExpiry = FindData($Data, '<li>Expires', '</li>', 11, 0, false, 0, false);
     if (substr($VExpiry, 0, 3) == 'in ') {
         $VExpiry = strtotime(str_ireplace('in ', '+', $VExpiry));
     } else {
         $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Title = CleanHTML($NewDeal['Title'][0]);
     $Locations = array();
     if ($NewDeal['Addresses'][0] !== false) {
         $Addresses = explode('],[', $NewDeal['Addresses'][0]);
         foreach ($Addresses as $Address) {
             $AdrName = FindData($Address, ', "', '"', 3, 0, false, 0, false);
             if ($AdrName !== false) {
                 $Coords = FindData($Address, '",', ', ', 2, 0, false, 0, false);
                 if ($Coords !== false && stripos($Coords, ',') !== false) {
                     $Coords = explode(',', $Coords);
                     $Locations[] = array(CleanHTML($AdrName), $Coords[0], $Coords[1]);
                 } else {
                     $Locations[] = array(CleanHTML($AdrName), 0, 0);
                 }
             }
         }
     }
     if (count($Locations) == 0) {
         $Locations[] = array(null, 0, 0);
     }
     $MoreDeals = array();
     $Start = stripos($Data, "/?wagjag=");
     while ($Start !== false) {
         $ID = FindData($Data, '/?wagjag=', "'", 9, 0, true, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = '/?wagjag=' . $ID;
         }
         $Start = stripos($Data, "/?wagjag=", $Start + 20);
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = trim($NewDeal['Website'][0]);
     }
     if ($Website == '') {
         $Website = null;
     }
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $Title;
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.wagjag.com/index.php?_page=home&wagjag=' . (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));
 }
コード例 #2
0
ファイル: Vieurbaine.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #3
0
ファイル: DealTicker.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.dealticker.com' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("DealTicker.txt", 'http://www.dealticker.com' . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, "id='newsletter_form'") !== false || stripos($Data, 'We will be coming to your city soon') !== false || stripos($Data, 'No Longer Available') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'product_id:', '"', '"', true), "Title" => array('', 'meta name="description"', 'content="', '"', false), "Website" => array('', 'auto; " >', 'href="', '"', false, true), "PriceSale" => array(0, '<td class="price"', '$', '<', true), "PriceReg" => array(0, 'You Save', '$', '<', true), "StoreName" => array('', 'div style="padding: 0 15px;"', '>', '</b>', false), "Description" => array('', 'id="description"', '>', '</div>', false), "Address" => array('', 'div style="padding: 0 15px;"', '<br>', '</div>', false, true), "EndD" => array(0, '"r_dd"', '>', '<', true, true), "EndH" => array(0, '"r_hh"', '>', '<', true, true), "EndM" => array(0, '"r_mm"', '>', '<', true, true), "EndS" => array(0, '"r_ss"', '>', '<', true, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', 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 = FindData($Data, 'Expires:', ')', 9, 0, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = array();
     if ($NewDeal['Address'][0] !== false && $NewDeal['Address'][0] != '') {
         if (stripos($NewDeal['Address'][0], 'located in') === false) {
             $Address = $NewDeal['Address'][0];
             $Address = trim(str_ireplace('<td>', ' ', $Address));
             $Address = trim(str_ireplace('</td>', ' ', $Address));
             $Address = trim(str_ireplace('<tr>', ' ', $Address));
             $Address = trim(str_ireplace('</tr>', ' ', $Address));
             $Address = trim(str_ireplace('&nbsp;', ' ', $Address));
             $Address = trim(str_ireplace('<br>', ' ', $Address));
             $Address = trim(str_ireplace(chr(9), ' ', $Address));
             $Address = trim(str_ireplace(chr(10), ' ', $Address));
             $Address = trim(str_ireplace(chr(13), ' ', $Address));
             while (stripos($Address, '  ')) {
                 $Address = trim(str_ireplace('  ', ' ', $Address));
             }
             if (stripos($Address, '</span>') === false) {
                 $Address = array($Address);
             } else {
                 $Lines = explode('</span>', $Address);
                 $Address = array();
                 foreach ($Lines as &$Line) {
                     if (stripos($Line, 'locations') === false) {
                         if (substr($Line, 0, 5) == '<span') {
                             $Line = trim(substr($Line, stripos($Line, '>') + 1));
                         } elseif (stripos($Line, '<span') !== false) {
                             $Line = trim(substr($Line, 0, stripos($Line, '<span')));
                         }
                         if (is_numeric(substr($Line, 0, stripos($Line, ' '))) && strlen($Line) >= 25) {
                             $Address[] = $Line;
                         }
                     }
                 }
             }
         }
     }
     $Locations = array();
     if (count($Address) > 0) {
         foreach ($Address as $Adr) {
             $Locations[] = array(CleanHTML($Adr), 0, 0);
         }
     } else {
         $Locations[] = array(null, 0, 0);
     }
     $Last = 0;
     $MoreDeals = array();
     $Start = stripos($Data, 'More Great DealTickers');
     while ($Start !== false) {
         $New = FindData($Data, '/product.php/product_id/', '"', 24, 0, true, $Start, false);
         if ($New !== false && $New > 0 && $New != $Last) {
             $MoreDeals[] = '/product.php/product_id/' . $New;
             $Last = $New;
         }
         $Start = stripos($Data, " <!-- Today's Side Deal -->", $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = '/product.php/product_id/' . $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.dealticker.com/product.php/product_id/' . $NewDeal['ID'][0];
     //$RDate['URL'] = 'http://www.DealTicker.com'.$URL.'/users/refer/4458/499/5fa1c87e50f3bef60631853dec007bc1';
     $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;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #4
0
ファイル: EvBuys_2.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.everybodybuys.com/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("EverybodyBuys.txt", $Data);
     }
     if (stripos($Data, 'class="subscriptions-content-form round-10 clearfix"') !== false) {
         return array(true, false);
     }
     //IF there is no deal, return false
     $NewDeal = array("ID" => array('', 'class="title"', 'href="', '"', false), "Title" => array('', 'class="title"', 'title="', '"', false), "Website" => array('', chr(13) . chr(10) . '                        <span class="ak-subtitle"', 'href="', '"', false, true), "Address" => array('', 'id="map_adress"', '>', '<br />', false), "PriceReg" => array('', 'class="ak-small-info ak-reg"', '$', '<', false), "PriceSale" => array(0, 'class="ak-value ak-num"', '>', '<', true), "StoreName" => array('', chr(13) . chr(10) . '                      <div class="ak-subside2">', 'class="ak-subtitle">', "<", false), "EndDate" => array(0, 'ak-value ak-time-left', 'js-time hide">', '<', true), "Description" => array('', 'Daily Write Up', '<p>', 'clear: left', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     if ((int) $NewDeal['EndDate'][0] <= 0) {
         return array(true, false);
     }
     $StartDate = time();
     $EndDate = $StartDate + (int) $NewDeal['EndDate'][0];
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     //Only operating in TO, so timezone always EST
     //$DateParts = explode(',', $DateEnds);
     //$EndDate = mktime((int)$DateParts[2], (int)$DateParts[3], (int)$DateParts[4], (int)$DateParts[0], (int)$DateParts[1], (int)date('Y'));
     //No Expiry, it will return 0 anyway
     $VExpiry = FindData($Data, 'Expiries', '</span>', 8, 0, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     //Need function prototype, would like to know what the function does with the needle.
     $MoreDeals = array();
     $Start = stripos($Data, "<div style='position: relative;'>");
     while ($Start !== false) {
         $ID = FindData($Data, 'href="/', '"', 6, 0, false, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = $ID;
         }
         $Start = stripos($Data, "<div style='position: relative;'>", $Start + 20);
         //Not sure if I need an 'offset' here??
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.everybodybuys.com' . $NewDeal['ID'][0];
     $RData['Price'] = (double) str_ireplace(',', '', $NewDeal['PriceSale'][0]);
     $RData['Value'] = (double) str_ireplace(',', '', $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));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, $RData);
 }
コード例 #5
0
ファイル: Dealathons.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #6
0
ファイル: SwarmJam.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #7
0
    @file_put_contents($ps_runfile, serialize($ps_file_arr));
}
$block_lst = array();
$block_list_way = 'addl/block_list_' . $config['user']['id'] . '.lst';
if (file_exists($block_list_way)) {
    $f_data = @file_get_contents($block_list_way);
    $block_lst = unserialize($f_data);
}
/********* ADDL::PUBLIC STATS *********/
$f = cdim('db', 'query', "SELECT * FROM `flows` WHERE user_id = " . $config['user']['id']);
if (isset($f)) {
    foreach ($f as $k => $v) {
        $ps_exists = false;
        $ps_public_key = false;
        if ($ps_file_arr !== FALSE) {
            $ps_data = FindData($ps_file_arr, array('user_id' => $config['user']['id'], 'flow_id' => $v->id));
            if ($ps_data != false) {
                $ps_exists = true;
                $ps_public_key = $ps_data['public_key'];
            }
        }
        $b_list_str = isset($block_lst[$v->id]) ? implode(',', $block_lst[$v->id]) : '';
        echo '
						<tr class="rig_line" data-userProxyLine="' . $v->id . '">
							<td class="rig_line_1"><span>Flow id</span>' . $v->id . '</td>
							<td class="rig_line_2">
								<select onChange="updateFlowFile(' . $v->id . ', this);" class="exeSelector" data-flowId="' . $v->id . '">
									' . getUserExeAsSelectOptions($v->file_id) . '
								</select>&nbsp;
								<input type="checkbox" name="public_stats" id="flow_' . $v->id . '" ' . ($ps_exists ? 'checked=\'true\'' : '') . ' onclick="flow_switch(' . $v->id . ');"> Public stats  ' . ($ps_exists ? '<a href="public_stats.php?pkey=' . $ps_public_key . '" target="_blank">Get link</a>' : '') . '
							</td>
コード例 #8
0
ファイル: Dealsnoop.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #9
0
ファイル: DealOn.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     //There is an automatic forward to NYC, http://www.dealon.com/new-york/deal/today/
     //What does $Sub look like, and $URL
     //I am still having issues with chr(13) etc. Ask Jonathan
     //Lets go over the date conversion, +1 with JavaScript needs checking
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.dealon.com/' . $URL);
     } else {
         list($Data, $DURL) = GetWebData('http://www.dealon.com/' . $URL . '/deal/today');
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("DealOn.txt", "http://www.dealon.com/" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'class="page-title"') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', 'class="deal-meter-buy"', 'href="/user/buy', '"', false), "Title" => array('', 'id="deal-title"', '>', '<', false), "Website" => array('', 'class="deal-details-right-column"', 'href="', '"', false, true), "PriceSale" => array(0, 'class="deal-meter-buy"', '$', '<', true), "PriceReg" => array(0, 'class="deal-discount"', '$', '<', true), "StoreName" => array('', '<h2>Company Information</h2>', '>', '<', false), "Description" => array('', '<h2>About This Deal</h2>', '<p>', '</div>', false), "Address" => array('', '<h2>Company Information</h2>', '<br/>', '<a', false, true), "EndDate" => array('', "('#countdown')", 'UTCDate(', ')', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     list($DateO, $DateY, $DateM, $DateD, $DateH, $DateN, $DateS, $DateI) = explode(',', $NewDeal['EndDate'][0]);
     $EndDate = mktime((int) $DateH + (-5 - (int) $DateO), (int) $DateN, (int) $DateS, (int) $DateM + 1, (int) $DateD, (int) $DateY);
     //Need to Add + 1, because JavaScript counts 0 to 11
     //Based on their plugin usage http://keith-wood.name/countdown.html
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindData($Data, 'Expiration Date:', '<', 17, 0, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     if ($Website == '') {
         $Website = null;
     }
     $Coords = array(0, 0);
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     if ($Address == 'Visit Online:') {
         $Address = null;
         $Coords = array(-1, -1);
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'class="bonus-deals"');
     while ($Start !== false) {
         $ID = FindData($Data, 'href="', '"', 6, 0, false, $Start, false);
         //What is 24, 0 for??
         if ($ID !== false) {
             $MoreDeals[] = $ID;
         }
         $Start = stripos($Data, '											<h3>', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     if ($Sub) {
         $RData['URL'] = 'http://www.dealon.com' . $URL;
     } else {
         $RData['URL'] = 'http://www.dealon.com/' . $URL . $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, $Coords[0], $Coords[1]));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #10
0
ファイル: Teambuy.php プロジェクト: j-mikhail/dealplotter
 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));
     }
 }
コード例 #11
0
ファイル: DealFind.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.dealfind.com/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("DealFind.txt", $Data);
     }
     if (stripos($Data, 'insanely monstrous') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'var DealID', '=', ';', true), "Title" => array('', 'var DealName', '"', '"', false), "URL" => array('', 'var AffiliateLinkURL', '"', '"', false), "PriceReg" => array(0, 'var RegularPriceHTML', "'\$", "'", true), "PriceSale" => array(0, 'var OurPriceHTML', "'\$", "'", true), "DealTime" => array(0, 'DealSeconds_Total', '=', ';', true), "DealElapsed" => array(0, 'DealSeconds_Elapsed', '=', ';', true), "DealStart" => array('', 'The deal went live', 'on', '<', false), "StoreName" => array('', 'itemprop="name"', '>', '<', false), "Description" => array('', 'class="dealText"', '>', '<div', false), "Website" => array('', 'itemprop="url"', 'href="', '"', false, true), "Address" => array('', 'itemprop="name"', 'itemprop="description">', chr(9) . '</div>', false, true), "Coords" => array('', 'point = new GLatLng', '(', ')', false, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time() - $NewDeal['DealElapsed'][0];
     $EndDate = $StartDate + $NewDeal['DealTime'][0];
     //Time measured in seconds, so no need for timezone adjustments
     $VExpiry = FindData($Data, 'Expires on', '.', 11, 0, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : strtotime($VExpiry);
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Coords = array(0, 0);
     if ($NewDeal['Coords'][0] !== false) {
         $Coords = explode(',', $NewDeal['Coords'][0]);
     }
     if ($Coords === false || count($Coords) != 2) {
         $Coords = array(0, 0);
     }
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     if (stripos($Address, 'map it') !== false) {
         $Address = trim(substr($Address, 0, stripos($Address, 'map it')));
     }
     if (stripos($Address, 'n/a') !== false) {
         $Address = trim(substr($Address, 0, stripos($Address, 'n/a')));
     }
     if (stripos($Address, 'redeem online') !== false || stripos($Address, 'redeem by phone') !== false || stripos($Address, 'mobile service') !== false) {
         $Address = null;
         $Coords = array(-1, -1);
     }
     //$Website = FindData($NewDeal['MoreData'][0], 'a href="', '"', 8, 0, false, 0, false);
     //if ($Website === false) $Website = '';
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     if (trim($Website) == '') {
         $Website = null;
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'class="side-deal');
     while ($Start !== false) {
         $ID = FindData($Data, 'href="', '"', 6, 0, false, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = $ID;
         }
         $Start = stripos($Data, 'class="side-deal', $Start + 20);
     }
     /*
     //Parse address
     $Address = $NewDeal['MoreData'][0];
     $Address = str_ireplace('<br/>', ', ', $Address);
     $Address = str_ireplace('website', '', $Address);
     $Address = str_ireplace('map it', '', $Address);
     $Address = substr(trim(CleanHTML($Address)), 2);
     */
     /*
     $AddressArray = explode(chr(13).chr(10), $NewDeal['MoreData'][0]);
     foreach ($AddressArray as $AddressItem) {
       if (stripos($AddressItem, '                ') !== false && stripos($AddressItem, '                  ') === false) {
         $Address = trim(substr($AddressItem, 0, stripos($AddressItem, '<br><a')));
         $Address = CleanHTML($Address);
         break;
       }
     }
     */
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = $NewDeal['URL'][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, $Coords[0], $Coords[1]));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #12
0
ファイル: Fabfind.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #13
0
ファイル: Tuango.php プロジェクト: j-mikhail/dealplotter
 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));
     }
 }
コード例 #14
0
ファイル: Maddeal.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('http://www.maddeal.com' . $URL);
     } else {
         list($Data, $DURL) = GetWebData('http://www.maddeal.com' . $URL . '/');
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Maddeal.txt", "http://www.maddeal.com" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'NoDeal.jpg') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, '?did', '=', '"', true), "Title" => array('', 'class="boldheaderarial"', '>', '<', false), "Website" => array('', 'id="ctl00_cphBody_busWebsite"', 'href="', '"', false, true), "PriceSale" => array(0, 'id="ctl00_cphBody_dealPrice"', '>', '<', true), "PriceReg" => array('', 'id="ctl00_cphBody_dealValue"', '>', '<', false), "StoreName" => array('', 'id="ctl00_cphBody_busName"', '>', '<', false), "Description" => array('', 'id="ctl00_cphBody_decription"', '<p>', '<br />', false), "Address" => array('', 'id="ctl00_cphBody_busLocation"><a', '>', '</a>', false, true), "Coords" => array('', 'id="ctl00_cphBody_busLocation"', '(', ')', false, true), "EndDate" => array('', 'id="ctl00_cphBody_remaining"', '>', '<', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = time();
     //Comming in HH:MM:SS
     list($hours, $minutes, $seconds) = explode(':', $NewDeal['EndDate'][0]);
     $EndDate += (int) $hours * 60 * 60;
     //Hours
     $EndDate += (int) $minutes * 60;
     //Minutes
     $EndDate += (int) $seconds;
     //Seconds
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindData($Data, chr(9) . chr(9) . 'Expires', '<', 9, 0, false, 0, false);
     $VExpiry = $VExpiry === false ? 0 : 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;
     }
     $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, 'id="ctl00_cphBodyLeft_divLeft"');
     while ($Start !== false) {
         $ID = FindData($Data, "document.location.href='", "'", 24, 0, false, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = $ID;
         }
         $Start = stripos($Data, 'id="ctl00_cphBodyLeft_divLeft"', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     if ($Sub) {
         $RData['URL'] = 'http://www.maddeal.com' . $URL . '&q=P22932';
     } else {
         $RData['URL'] = 'http://www.maddeal.com' . $URL . '?did=' . $NewDeal['ID'][0] . '&q=P22932';
         //http://www.maddeal.com/Canada/ON/Toronto/?did=216
     }
     $RData['Price'] = (double) $NewDeal['PriceSale'][0];
     $RData['Value'] = (double) substr($NewDeal['PriceReg'][0], 1);
     $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, $Coords[0], $Coords[1]));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #15
0
ファイル: ILoveMTL.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #16
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://dealoftheday.redflagdeals.com/deal/' . $URL, null, 'dealoftheday.redflagdeals.com_splashIgnored=0');
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("RedFlagDeals.txt", $Data);
     }
     $NewDeal = array("Title" => array('', 'og:title', 'content="', '"', false), "URL" => array('', 'data-url=', '"http://dealoftheday.redflagdeals.com', '?', false), "StoreName1" => array('', 'merchantAddress_192', '<b>', '</b>', false, true), "StoreName2" => array('', 'name="keywords" content=', '"', ',', false, true), "Website" => array('', 'merchantAddress_192', 'href="', '"', false, true), "PriceSale" => array(0, 'detailsPageDealInfoPrice', '"wrappedPriceValue">', '<', true), "PriceReg" => array(0, 'origPriceValue', '$', '<', true), "Description" => array('', 'prodDescriptionText', '>', '</div>', false), "Address" => array('', 'addresses.push(', '"', '"', false, true), "TimeL" => array('', ' DealTimeClass', '(', ')', false), "Expiry" => array('', 'expires', ' ', '<', false, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = time();
     $DateParts = explode(',', $NewDeal['TimeL'][0]);
     if ($DateParts === false) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     if (trim($DateParts[0]) != 'null') {
         $EndDate += (int) substr(trim($DateParts[0]), 1, strlen(trim($DateParts[0])) - 2) * 24 * 60 * 60;
     }
     if (trim($DateParts[1]) != 'null') {
         $EndDate += (int) substr(trim($DateParts[1]), 1, strlen(trim($DateParts[1])) - 2) * 60 * 60;
     }
     if (trim($DateParts[2]) != 'null') {
         $EndDate += (int) substr(trim($DateParts[2]), 1, strlen(trim($DateParts[2])) - 2) * 60;
     }
     if (trim($DateParts[3]) != 'null') {
         $EndDate += (int) substr(trim($DateParts[3]), 1, strlen(trim($DateParts[3])) - 2);
     }
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $StoreName = '';
     if ($StoreName == '' && $NewDeal['StoreName1'][0] !== false) {
         $StoreName = $NewDeal['StoreName1'][0];
     }
     if ($StoreName == '' && $NewDeal['StoreName2'][0] !== false) {
         $StoreName = $NewDeal['StoreName2'][0];
     }
     if ($StoreName == '') {
         return array(SysLogIt('Could not determine store name.', StatusError), null);
     }
     $VExpiry = false;
     if ($NewDeal['Expiry'][0] !== false) {
         $VExpiry = $NewDeal['Expiry'][0];
         if (stripos($VExpiry, '(') !== false) {
             $VExpiry = substr($VExpiry, 0, stripos($VExpiry, '('));
         }
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     //Initialize location array
     $Locations = array();
     //Look for first instance of addresses.push
     $Start = stripos($Data, 'addresses.push"');
     while ($Start !== false) {
         //Get first content between parenthesis immediately after addresses.push
         $New = FindData($Data, '("', '")', 2, 0, false, $Start, false);
         //If found, add to locations array
         if ($New !== false) {
             $Locations[] = array($New, 0, 0);
         }
         //Check for next instance, starting at previous location + 20
         $Start = stripos($Data, 'addresses.push', $Start + 20);
     }
     //If no addresses were found, add null address
     if (count($Locations) == 0) {
         $Locations[] = array(null, 0, 0);
     }
     $Website = null;
     if ($NewDeal['Website'][0] !== false) {
         $Website = $NewDeal['Website'][0];
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'id="sideDealsSection"');
     while ($Start !== false) {
         $New = FindData($Data, 'http://dealoftheday.redflagdeals.com/deal/', '"', 42, 0, false, $Start, false);
         if ($New !== false) {
             $MoreDeals[] = $New;
         }
         $Start = stripos($Data, 'id="sideDealsSection"', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = $URL;
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://dealoftheday.redflagdeals.com' . $NewDeal['URL'][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'] = $StoreName;
     $RData['Website'] = $Website;
     $RData['Locations'] = $Locations;
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #17
0
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.stealthedeal.com/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("StealTheDeal.txt", $Data);
     }
     if (stripos($Data, 'og:url') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'og:url', 'stealthedeal.com/deal/', '"', true), "Title" => array('', 'og:title', 'content="', '"', false), "PriceSale" => array(0, 'dealPrice', '$', '<', true), "PriceReg" => array(0, '"valueTitle"', '$', '<', true), "Website" => array('', 'Merchant website:', 'href="', '"', false, true), "Description" => array('', 'DescriptionHtml Start', '>', '<!', false), "Address" => array('', 'maps.google', ';q=', '&', false, true), "Coords" => array('', 'maps.google', ';ll=', '&', false, true), "Address2" => array('', 'DetailsHtml', '</li>', '</ul>', false, true), "TZone" => array(0, 'TzOffset', '=', ';', true), "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]);
     $EndDate += -(((int) $NewDeal['TZone'][0] + 5) * 60 * 60);
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $StoreName = '';
     if (stripos($NewDeal['Title'][0], ' from ') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], ' from ') + 6);
     } elseif (stripos($NewDeal['Title'][0], ' at ') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], ' at ') + 4);
     } elseif (stripos($NewDeal['Title'][0], ' by ') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], ' by ') + 4);
     } elseif (stripos($NewDeal['Title'][0], ' to ') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], ' to ') + 4);
     } elseif (stripos($NewDeal['Title'][0], 'for a') !== false && stripos($NewDeal['Title'][0], 'voucher') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], 'for a') + 5);
         $StoreName = trim(substr($StoreName, 0, stripos($NewDeal['Title'][0], 'voucher')));
         if (substr($StoreName, 0, 2) == 'n ') {
             $StoreName = trim(substr($StoreName, 2));
         }
     } elseif (stripos($NewDeal['Title'][0], ' with ') !== false) {
         $StoreName = substr($NewDeal['Title'][0], stripos($NewDeal['Title'][0], ' with ') + 6);
     }
     if (stripos($StoreName, '(') !== false) {
         $StoreName = trim(substr($StoreName, 0, stripos($StoreName, '(') - 1));
     }
     if ($StoreName == '') {
         return array(SysLogIt('Could not determine store name.', StatusError), null);
     }
     $VExpiry = 0;
     if (stripos($Data, 'Please use within') !== false) {
         $VExpiry = FindData($Data, 'Please use within', 'of', 17, 0, false, 0, false);
         if ($VExpiry !== false) {
             $VExpiry = strtotime('+' . $VExpiry);
         }
     } elseif (stripos($Data, 'Expires on') !== false) {
         $VExpiry = FindData($Data, 'Expires on', '<', 10, 0, false, 0, false);
         if ($VExpiry !== false) {
             $VExpiry = strtotime($VExpiry);
         }
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = $NewDeal['Address'][0] === false ? null : str_ireplace('+', ' ', $NewDeal['Address'][0]);
     if (is_null($Address) && $NewDeal['Address2'][0] !== false) {
         $Address = CleanHTML(str_ireplace('map it', '', $NewDeal['Address2'][0]));
     }
     if ($Address == '') {
         $Address = 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);
     }
     $Last = (int) $NewDeal['ID'][0];
     $MoreDeals = array();
     $Start = stripos($Data, 'class="sideBox sideDeal"');
     if ($Start !== false) {
         $Start = stripos($Data, '/Deal/', $Start);
     }
     while ($Start !== false) {
         $New = FindData($Data, "/Deal/", '"', 6, 0, true, $Start, false);
         if ($New !== false && $New > 0 && $New != $Last) {
             $MoreDeals[] = '/' . $URL . '/Deal/' . $New;
             $Last = $New;
         }
         $Start = stripos($Data, "/Deal/", $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = (int) $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.stealthedeal.com/' . $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'] = $NewDeal['Website'][0];
     $RData['Locations'] = array(array($Address, $Coords[0], $Coords[1]));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #18
0
    if ($e !== FALSE) {
        $p = $e;
        $e = $arr[$e];
        $e['num'] = $p;
        unset($arr);
        return $e;
    }
    return false;
}
$ps_runfile = './addl/ps_runfile';
$ps_file_arr = array();
if (file_exists($ps_runfile)) {
    $ps_filedata = @file_get_contents($ps_runfile);
    if ($ps_filedata !== FALSE) {
        $ps_file_arr = unserialize($ps_filedata);
        $fd = FindData($ps_file_arr, array('public_key' => $pkey));
        if ($fd !== false) {
            $user_id = (int) $fd['user_id'];
            $flow_id = (int) $fd['flow_id'];
        } else {
            die('Unknown pkey');
        }
    }
}
$ard = array();
$all_result = cdim('db', 'query', "SELECT COUNT(*) as cnt FROM `traff` WHERE user_id = " . $user_id . " AND flow_id = " . $flow_id);
$all_res_exp = cdim('db', 'query', "SELECT COUNT(*) as cnt FROM `traff` WHERE user_id = " . $user_id . " AND flow_id = " . $flow_id . " AND `exp` != ''");
$top10 = cdim('db', 'query', "SELECT COUNT(*) as cnt, cc FROM `traff` WHERE user_id = " . $user_id . " AND flow_id = " . $flow_id . " GROUP BY cc ORDER BY cnt DESC LIMIT 10");
foreach ($top10 as $k => $v) {
    $ans = cdim('db', 'query', "SELECT COUNT(*) AS expl, cc FROM `traff` WHERE user_id = " . $user_id . " AND flow_id = " . $flow_id . " AND cc = '" . $v->cc . "' AND `exp` != ''");
    $ah = array_shift($ans);
コード例 #19
0
ファイル: PriceDodger.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.pricedodger.com' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("PriceDodger.txt", 'http://www.pricedodger.com' . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, 'id="deal_intro"') === false || stripos($Data, 'deal ended at') !== false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', 'id="deal_intro"', '/deal/', '"', false), "URL" => array('', 'id="deal_intro"', 'a href="', '"', false), "Title" => array('', 'id="deal_intro"', 'title="', '"', false), "Website" => array('', 'class="company_link', 'href="', '"', false, true), "PriceSale" => array(0, 'class="price">$', '>', '<', true), "PriceReg" => array(0, 'class="value">$', '>', '<', true), "StoreName" => array('', 'class="company_link', '<span ', '</span>', false), "Description" => array('', 'id="deal_desc"', '>', 'class="company', false), "Address" => array('', 'id="deal_desc"', '</u>', '</span>' . chr(9) . chr(9), false, true), "Coords" => array('', 'maps.google.com', '?center=', '&', false, true), "EndDate" => array('', 'id="time_left"', '                        ', '<div>', false));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = time();
     if (stripos($NewDeal['EndDate'][0], 'days') !== false) {
         $EndDate += 60 * 60 * 24 * (int) substr($NewDeal['EndDate'][0], 0, stripos($NewDeal['EndDate'][0], 'days') - 1);
         $EndDate += (int) FindData($NewDeal['EndDate'][0], '&nbsp;', 'H', 6, 0, false) * 60 * 60;
     } else {
         $EndDate += (int) substr($NewDeal['EndDate'][0], 0, stripos($NewDeal['EndDate'][0], 'H')) * 60 * 60;
     }
     $EndDate += (int) FindData($NewDeal['EndDate'][0], ';:&nbsp;', 'M', 8, 0, false) * 60;
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindData($Data, '>Expires', '<', 9, 0, false, 0, false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $StoreName = $NewDeal['StoreName'][0];
     $StoreName = trim(str_replace('class="c">', ' ', $StoreName));
     $StoreName = trim(str_replace('class="c1">', ' ', $StoreName));
     $Address = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = 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, 'id="side_deal"');
     while ($Start !== false) {
         $New = FindData($Data, 'http://pricedodger.com/deal/', '"', 28, 0, false, $Start, false);
         if ($New !== false) {
             $MoreDeals[] = '/deal/' . $New;
         }
         $Start = stripos($Data, 'id="side_deal"', $Start + 20);
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'http://www.pricedodger.com' . $NewDeal['URL'][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'] = $StoreName;
     $RData['Website'] = $NewDeal['Website'][0];
     $RData['Locations'] = array(array($Address, $Coords[0], $Coords[1]));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #20
0
ファイル: Kijiji.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     list($Data, $DURL) = GetWebData('http://www.kijijideals.ca/deals/' . $URL);
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("Kijiji.txt", "http://www.kijijideals.ca/deals/" . $URL . chr(13) . chr(10) . chr(13) . chr(10) . $Data);
     }
     if (stripos($Data, '/buy"') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array('', 'id="toDeal"', 'kijijideals.ca/deals/', '"', false), "Title" => array('', 'id="toDeal">', '>', '</a>', false), "Website" => array('', 'class="location_box"', 'href="', '"', false, true), "PriceSale" => array(0, 'class="price"', '$', '<', true), "PriceReg" => array(0, 'class="value"', '$', '<', true), "StoreName" => array('', 'class="location_box"', '<p>', '<', false), "Description" => array('', 'About this deal', '<p>', '</p>', false), "Address" => array('', 'maps.google.com', '?q=', '"', false, true), "EndDate" => array('', 'ready(function()', 'setCountdown("', '"', 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);
     }
     if ($EndDate < time()) {
         return array(true, false);
     }
     $VExpiry = FindData($Data, '<p>Expires', 'from', 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 = null;
     if ($NewDeal['Address'][0] !== false) {
         $Address = CleanHTML($NewDeal['Address'][0]);
     }
     if ($Address == '') {
         $Address = null;
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'class="dealBox ');
     while ($Start !== false) {
         $ID = FindData($Data, 'href="http://www.kijijideals.ca/deals/', '"', 38, 0, false, $Start, false);
         if ($ID !== false) {
             $MoreDeals[] = $ID;
         }
         $Start = stripos($Data, 'class="dealBox ', $Start + 20);
     }
     $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.kijijideals.ca/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));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #21
0
            $e = $k;
            break;
        }
    }
    if ($e !== FALSE) {
        $p = $e;
        $e = $arr[$e];
        $e['num'] = $p;
        unset($arr);
        return $e;
    }
    return false;
}
$ps_runfile = '../addl/ps_runfile';
$ps_file_arr = array();
if (file_exists($ps_runfile)) {
    $ps_filedata = @file_get_contents($ps_runfile);
    if ($ps_filedata !== FALSE) {
        $ps_file_arr = unserialize($ps_filedata);
        $fd = FindData($ps_file_arr, array('user_id' => $user_id, 'flow_id' => $flow_id));
        if ($fd === false) {
            $public_key = md5($user_id . $flow_id . time() + rand(1000, 9999));
            $ps_file_arr[] = array('user_id' => $user_id, 'flow_id' => $flow_id, 'public_key' => $public_key);
        } else {
            $num = $fd['num'];
            unset($ps_file_arr[$num]);
        }
        @file_put_contents($ps_runfile, serialize($ps_file_arr));
    }
}
exit(json_encode(array('type' => 'success', 'msg' => 'Public stats was switched')));
コード例 #22
0
ファイル: WebPiggy.php プロジェクト: j-mikhail/dealplotter
 public function GetDivisionData($SRID, $URL, $LID, $TZ, $Sub = false, $WebD = false)
 {
     global $DebugMode;
     if ($Sub) {
         list($Data, $DURL) = GetWebData('https://www.webpiggy.com/deals/side_deal/' . $URL, null);
     } else {
         list($Data, $DURL) = GetWebData('https://www.webpiggy.com/' . $URL, null);
     }
     if ($Data === false) {
         return array(SysLogIt('Error getting web data.', StatusError), null);
     }
     if ($DebugMode) {
         file_put_contents("WebPiggy.txt", $Data);
     }
     if (stripos($Data, 'id="deal_action"') === false) {
         return array(true, false);
     }
     $NewDeal = array("ID" => array(0, 'id="deal_action"', '/deals/buy/', '"', true), "Title" => array('', 'id="centre_title">', '">', '<', false), "Website1" => array('', 'deal_desc_col2', '<br/><a href="http://', '"', false, true), "Website2" => array('', 'deal_desc_col2', '<a href="', '"target="_blank"', false, true), "PriceSale" => array(0, 'id="deal_price"', '$', '<', true), "PriceReg" => array(0, '<li>Value', '$', '<', true), "StoreName1" => array('', '<br/><a href="http://', '>', '<', false, true), "StoreName2" => array('', 'id="deal_desc_col2"', '"_blank">', '<', false, true), "Description" => array('', 'deal_desc_col2', '<p>', '</p>', false), "Ends" => array('', '<p>', 'var dthen = new Date("', '");', false), "Address2" => array('', 'maps.google.ca', '&hnear=', '&', false, true), "Address1" => array('', 'maps.google.ca', '&q=', '&', false, true));
     if (!GetNewDealData($Data, $NewDeal)) {
         return array(SysLogIt('Error finding key deal information.', StatusError), null);
     }
     $StartDate = time();
     $EndDate = strtotime($NewDeal['Ends'][0]);
     if ($EndDate <= time()) {
         return array(SysLogIt('Could not determine deal end date.', StatusError), null);
     }
     $VExpiry = FindData($Data, 'Expiry ', '.', 7, 0, false, 0, false);
     if ($VExpiry !== false) {
         $VExpiry = strtotime($VExpiry);
     }
     if ($VExpiry === false) {
         $VExpiry = 0;
     }
     $Address = '';
     if ($NewDeal['Address1'][0] !== false) {
         $Address = CleanHTML(str_replace('+', ' ', $NewDeal['Address1'][0]));
     }
     if ($Address == '' && $NewDeal['Address2'][0] !== false) {
         $Address = CleanHTML(str_replace('+', ' ', $NewDeal['Address2'][0]));
     }
     if ($Address == '') {
         $Address = null;
     }
     $Website = null;
     if ($NewDeal['Website1'][0] !== false) {
         $Website = 'http://' . $NewDeal['Website1'][0];
     } elseif ($NewDeal['Website2'][0] !== false) {
         $Website = 'http://' . $NewDeal['Website2'][0];
     }
     if ($Website == '') {
         $Website = null;
     }
     $StoreName = '';
     if ($NewDeal['StoreName1'][0] !== false) {
         $StoreName = 'http://' . $NewDeal['StoreName1'][0];
     } elseif ($NewDeal['StoreName2'][0] !== false) {
         $StoreName = 'http://' . $NewDeal['StoreName2'][0];
     }
     if ($StoreName == '') {
         return array(SysLogIt('Could not determine store name.', StatusError), null);
     }
     $MoreDeals = array();
     $Start = stripos($Data, 'id="side_deal"');
     if ($Start !== false) {
         $Start = stripos($Data, 'class="deal_talk_content"', $Start);
         while ($Start !== false) {
             $New = FindData($Data, 'href="/deals/side_deal/', '"', 23, 0, true, $Start, false);
             if ($New !== false && $New > 0) {
                 $MoreDeals[] = $New;
             }
             $Start = stripos($Data, 'class="deal_talk_content"', $Start + 20);
         }
     }
     $RData = array();
     $RData['DRID'] = $NewDeal['ID'][0];
     $RData['Title'] = $NewDeal['Title'][0];
     $RData['Descr'] = $NewDeal['Description'][0];
     $RData['URL'] = 'https://www.webpiggy.com/deals/side_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'] = $StoreName;
     $RData['Website'] = $Website;
     $RData['Locations'] = array(array($Address, 0, 0));
     if (count($MoreDeals) > 0) {
         $RData['Deals'] = $MoreDeals;
     }
     return array(true, array($RData));
 }
コード例 #23
0
ファイル: GrouponCA.php プロジェクト: j-mikhail/dealplotter
 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));
 }
コード例 #24
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));
 }