当前位置: 首页>>代码示例>>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;未经允许,请勿转载。