當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parser::getHtml方法代碼示例

本文整理匯總了PHP中Parser::getHtml方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parser::getHtml方法的具體用法?PHP Parser::getHtml怎麽用?PHP Parser::getHtml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parser的用法示例。


在下文中一共展示了Parser::getHtml方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAllData

 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;
 }
開發者ID:vikas1234saini,項目名稱:dealagg,代碼行數:27,代碼來源:Sulekha.php

示例2: getAllData

 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;
 }
開發者ID:vikas1234saini,項目名稱:dealagg,代碼行數:21,代碼來源:Tradus.php

示例3: getAllData

 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;
 }
開發者ID:vikas1234saini,項目名稱:dealagg,代碼行數:22,代碼來源:FutureBazar.php

示例4: testInit

 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());
 }
開發者ID:necromant2005,項目名稱:tt-html,代碼行數:5,代碼來源:ParserTest.php


注:本文中的Parser::getHtml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。