本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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());
}