public function getAllData() { $url = $this->getWebsiteUrl(); $parser = new Parser(); $html = $parser->getHtml($url); phpQuery::newDocumentHTML($html); $data = array(); $data['logo'] = $this->getLogo(); $data['sitename'] = "Sulekha.com"; foreach (pq(".box") as $item) { $class_Discount_bg = pq($item)->find(".dealimgst"); $href = pq($class_Discount_bg)->find("a")->attr("href"); $href = 'http://deals.sulekha.com' . $href; $actual_price = trim(pq($item)->find(".dlpristrk")->text()); $actual_price = (int) preg_replace('~\\D~', '', $actual_price); $img_src = pq($class_Discount_bg)->find("img")->attr("src"); $price = trim(pq($item)->find(".hgtlgtorg")->text()); $price = (int) preg_replace('~\\D~', '', $price); $off_percent = $actual_price - $price; $off_percent = number_format($off_percent) . "/-"; $price = number_format($price) . "/-"; $name = trim(pq($item)->find(".deallstit>a")->text()); //$time_left = pq($item)->find(".countdown_row")->text(); $data[] = array('name' => $name, 'href' => $href, 'price' => 'Rs.' . $price, 'image' => $img_src, 'off' => 'Rs.' . $off_percent); } return $data; }
public function getAllData() { $url = $this->getWebsiteUrl(); $parser = new Parser(); $html = $parser->getHtml($url); phpQuery::newDocumentHTML($html); $data = array(); $data['logo'] = $this->getLogo(); $data['sitename'] = "Tradus.com"; foreach (pq(".cartList") as $item) { $class_Discount_bg = pq($item)->find(".Discount_bg"); $href = pq($class_Discount_bg)->find("a")->attr("href"); $off_percent = trim(pq($class_Discount_bg)->find(".offDiv_20>span")->text()); $img_src = pq($class_Discount_bg)->find(".toshiba>img")->attr("src"); $price = trim(pq($item)->find(".signDiv2")->text()); $name = trim(pq($item)->find(".DiscountDiv>a")->text()); $time_left = pq($item)->find(".countdown_row")->text(); $data[] = array('name' => $name, 'href' => $href, 'price' => $price, 'image' => $img_src, 'off' => $off_percent, 'time_left' => $time_left); } return $data; }
public function getAllData() { $url = $this->getWebsiteUrl(); $parser = new Parser(); $html = $parser->getHtml($url); phpQuery::newDocumentHTML($html); $data = array(); $data['logo'] = $this->getLogo(); $data['sitename'] = "FutureBazaar.com"; foreach (pq(".greed_inner") as $item) { $class_Discount_bg = pq($item)->find(".item_img"); $href = pq($item)->find("a")->attr("href"); $href = "http://www.futurebazaar.com" . $href; $off_percent = trim(pq($class_Discount_bg)->find(".home_sprite>span>strong")->text()); $img_src = pq($class_Discount_bg)->find(".podimg")->attr("prodsrc"); $price = trim(pq($item)->find(".offer_price")->text()); $name = trim(pq($item)->find("h3>a")->text()); // $time_left = pq($item)->find(".countdown_row")->text(); $data[] = array('name' => $name, 'href' => $href, 'price' => $price, 'image' => $img_src, 'off' => $off_percent); } return $data; }
public function testInit() { $parser = new Parser('<html><head></head><body /></html>'); $this->assertEquals('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><html><head></head><body /></html>', $parser->getHtml()); }