$dealpageArray[vendor_name] = $html->find('strong', 0)->innertext; $dealpageArray[address_all] = $html->find('table tbody tr td', 0)->innertext; $siteArray[] = $dealpageArray; echo '<pre>'; print_r($siteArray); echo '</pre>'; exit; $switch = 0; foreach ($html->find('div.image-wrapper a') as $e) { unset($dealpageArray); if ($switch) { $switch = 0; $dealpageArray[url] = 'http://homerun.com' . $e->href; $inHtml = file_get_html($dealpageArray[url]); $dealpageArray[title] = str_replace("HomeRun.com :: ", "", $inHtml->find('title', 0)->innertext); $dealpageArray[price] = numberOnly(str_replace("Buy Now \$", "", $inHtml->find('button', 0)->innertext)); $dealpageArray[value] = stripAllNonNumerical($inHtml->find('td.val span', 0)->innertext); $dealpageArray[vendor_name] = $inHtml->find('div.spot div', 0)->innertext; $dealpageArray[address_all] = $inHtml->find('div.spot div', 1)->innertext; $dealpageArray[img_url] = $inHtml->find('img.deal', 0)->src; $geo = $Application->getGeoCoord($dealpageArray[address]); $dealpageArray[longitude] = $geo['lng']; $dealpageArray[latitude] = $geo['lat']; $dealpageArray[source_id] = "12"; $dealpageArray[location_id] = "6"; $siteArray[] = $dealpageArray; } else { $switch = 1; } // $dealpageArray[expires] = strtotime('midnight'); //
<?php $dealpageArray[url] = "http://livingsocial.com/deals?preferred_city=4"; $html = file_get_html($dealpageArray[url]); $dealpageArray[title] = $html->find('title', 0)->innertext; $dealpageArray[img_url] = $html->find('div.grid_5', 0)->style; $dealpageArray[img_url] = get_string_between($dealpageArray[img_url], "url(", ")"); $dealpageArray[price] = numberOnly($html->find('div.deal-price', 0)->plaintext); $dealpageArray[value] = str_replace("\$", "", $html->find('span.value-unit strong', 0)->innertext); $dealpageArray[expires] = strtotime('midnight + 5 hours'); $dealpageArray[source_id] = "4"; $dealpageArray[region_id] = "6"; $siteArray[] = $dealpageArray; echo '<pre>'; print_r($siteArray); echo '</pre>';
function updateProduct($data, $id) { unset($data['product_id']); unset($data['image_id']); // unset($data['stock']); // unset($data['qty']); $data['price'] = numberOnly($data['price']); $data['price_en'] = numberOnly($data['price_en']); $query = $this->db->update('product', $data, array('product_id' => $id)); return $query; }