本文整理匯總了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());
}