本文整理汇总了PHP中getHTML函数的典型用法代码示例。如果您正苦于以下问题:PHP getHTML函数的具体用法?PHP getHTML怎么用?PHP getHTML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getHTML函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseGG
function parseGG($name)
{
$url = "http://www.gamersgate.com/DD-" . $name . "/";
$html = getHTML($url);
preg_match("/price_price(.*)>([0-9]+)/", $html, $match);
$price = $match[2];
return $price;
}
示例2: parseGMG
function parseGMG($name)
{
$url = "http://www.greenmangaming.com/s/ru/en/pc/games/" . $name . "/";
$html = getHTML($url);
preg_match("/\"product_price_readable\": \"[0-9]+?(\\.[0-9]+)\"/", $html, $match);
$price = $match[0];
return explode(":", $price)[1];
}
示例3: parseSteam
function parseSteam($gameid)
{
$url = "http://store.steampowered.com/app/" . $gameid . "/";
$html = getHTML($url);
preg_match("/itemprop=\"price\".*\"([0-9]+?,?[0-9]+)\"/", $html, $match);
$price = $match[1];
return array($price, $url, "Steam");
}
示例4: fileupload_process
function fileupload_process($file)
{
$attachment = handle_file($file);
if (is_array($attachment)) {
$html = getHTML($attachment);
$response = array('success' => true, 'html' => $html, 'attach' => $attachment['id']);
echo json_encode($response);
exit;
}
$response = array('success' => false);
echo json_encode($response);
exit;
}
示例5: displayCFRow
public static function displayCFRow($row_key, $keyspace_name, $columnfamily_name, $row, $scf_key = null, $is_counter_column = false)
{
$vw_vars['scf_key'] = $scf_key;
$vw_vars['row'] = $row;
$vw_vars['keyspace_name'] = $keyspace_name;
$vw_vars['columnfamily_name'] = $columnfamily_name;
$vw_vars['row_key'] = $row_key;
// If it's a column family of counter
if ($is_counter_column) {
return getHTML('columnfamily_row_counter.php', $vw_vars);
} else {
return getHTML('columnfamily_row.php', $vw_vars);
}
}
示例6: parseGOG
function parseGOG($name)
{
$gameName = prepareNameGOG($name);
$url = "http://www.gog.com/game/" . $gameName;
$html = getHTML($url);
preg_match("/buy-price__new(.*)>([0-9]+)/", $html, $match_disc);
preg_match("/class=\"buy-price(.*)>([0-9]+)/", $html, $match);
if (count($match_disc[0]) != 0) {
$price = $match[2] < $match_disc[2] ? $match[2] : $match_disc[2];
} else {
$price = $match[2];
}
return array($price, $url, "GOG");
}
示例7: loader
/**
* @brief Charge les fichiers Javascript selon le nom de la page et selon l'état de l'application (production ou développement)
* @param String $controlName Nom de la page qui demande à inclure le Javascript
* @return String Code HTML nécessaire à l'inclusion du/des codes Javascript
* @see JSLoader::$production
*/
public static function loader($controlName)
{
$result = "";
if (self::$production == false) {
$file = array();
if (file_exists(self::$base . "common.js")) {
$file[] = self::$base . 'common.js';
}
if (file_exists(self::$base . $controlName . ".js")) {
$file[] = self::$base . $controlName . ".js";
}
foreach ($file as $f) {
$result .= self::getHTML($f);
}
} else {
$result = getHTML(self::$base . self::$prodJS);
}
return $result;
}
示例8: getCast
function getCast($tt, &$title = '')
{
$html = getHTML($tt);
if (preg_match('#<h3 itemprop="name">[\\s\\S]+?</h3>#i', $html, $match)) {
$title = _clean($match[0]);
// var_dump($title);
}
if (preg_match('#<table class="cast_list">([\\s\\S]+?)</table>#i', $html, $match)) {
$table = $match[1];
// preg_match_all('#itemprop="actor"[^<]+([\s\S]+?)</td>#', $table, $matches);
// $actors = array_map(
preg_match_all('#itemprop="actor"[\\s\\S]+?href="/name/(nm\\d+)[^>]+>([\\s\\S]+?)</a>#i', $table, $matches);
$ids = array_map('_clean', $matches[1]);
$actors = array_map('_clean', $matches[2]);
// print_r($ids);
$actors = array_combine($ids, $actors);
// print_r($actors);
preg_match_all('#<td class="character">([\\s\\S]+?)(?:\\(|/ \\.|</td)#i', $table, $matches);
$characters = array_map('_clean', $matches[1]);
$characters = array_combine($ids, $characters);
// print_r($characters);
return (object) compact('actors', 'characters');
}
}
示例9: getHTML
<?php
$html = getHTML('http://themoneyballunion.com/game/StatsLab//widget.php?stat=pwar&topX=10', 10);
$html = utf8_encode($html);
echo $html;
?>
</div>
<div id='panel3' class="panel">
<h3>HR leaders</h3>
<?php
$html = getHTML('http://themoneyballunion.com/game/StatsLab//widget.php?stat=hr&topX=10', 10);
$html = utf8_encode($html);
echo $html;
?>
<h3>Hit leaders</h3>
<?php
$html = getHTML('http://themoneyballunion.com/game/StatsLab//widget.php?stat=h&topX=10', 10);
$html = utf8_encode($html);
echo $html;
?>
</div>
</aside>
<div class="news">
<h2>Breaking News</h2>
<div class="articles">
<?php
include 'simple_html_dom.php';
//set up curl
$ch = curl_init("http://www.themoneyballunion.com/game/lgreports//leagues/league_100_home.html");
示例10: define
require 'helper/ClusterHelper.php';
require 'helper/ColumnFamilyHelper.php';
require 'helper/MX4J.php';
require 'conf.inc.php';
define('MINIMUM_THRIFT_API_VERSION_FOR_COUNTERS', '19.10.0');
$cluster_helper = new ClusterHelper($CASSANDRA_CLUSTERS);
session_start();
// Make sure the cluster index in the session still exists in the config array
if ($cluster_helper->getClusterIndex() > $cluster_helper->getClustersCount() - 1) {
$_SESSION['cluster_index'] = 0;
}
try {
$random_server = $cluster_helper->getRandomNodeForCurrentCluster();
$sys_manager = new SystemManager($random_server, $cluster_helper->getCredentialsForCurrentCluster(), 1500, 1500);
} catch (TException $e) {
die(getHTML('header.php') . getHTML('server_error.php', array('error_message' => displayErrorMessage('cassandra_server_error', array('error_message' => $e->getMessage())))) . getHTML('footer.php'));
}
/*
Get the specified view and replace the php variables
*/
function getHTML($filename, $php_params = array())
{
if (!file_exists('views/' . $filename)) {
die('The view ' . $filename . ' doesn\'t exist');
}
// If we got some params to be treated in php
extract($php_params);
ob_start();
include 'views/' . $filename;
$content = ob_get_contents();
ob_end_clean();
示例11: scrape_between
return $res;
}
function scrape_between($data, $start, $end)
{
$data = stristr($data, $start);
// Stripping all data from before $start
$data = substr($data, strlen($start));
// Stripping $start
$stop = stripos($data, $end);
// Getting the position of the $end of the data to scrape
$data = substr($data, 0, $stop);
// Stripping all data from after and including the $end of the data to scrape
return $data;
// Returning the scraped data from the function
}
$result = getHTML("http://www.snapdeal.com/product/hp-stream-8-windows-tablet/672158959721?", 0);
function getTitle($result)
{
preg_match('/(.*)<\\/h1>/i', $result, $title);
$ret = scrape_between($title[0], '<h1 itemprop="name" class=\'font20\'>', "</h1>");
return $ret;
}
function getImg($result, $title)
{
preg_match_all('/<img title=(.*) itemprop="image" (.*)>/i', $result, $img);
$img_url = scrape_between($img[0][0], 'src="', '"');
return $img_url;
}
function getMRP($result)
{
preg_match_all('/original-price-id">(.*)</i', $result, $MRP);
示例12: init
/**
* entry point
*/
function init()
{
try {
//connect to database
$db = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PASSWORD);
$preparedParams = array();
$statuses = $_POST["statuses"];
$html = "";
$pagingStatus = null;
$filter = "";
$sort = "";
$query = "";
if (isset($statuses)) {
//statuses => array
$statuses = json_decode(urldecode($statuses));
foreach ($statuses as $key => $value) {
switch ($value->action) {
case "paging":
$pagingStatus = $value;
break;
case "filter":
$filter .= getFilterQuery($value, $filter, $preparedParams);
break;
case "sort":
$sort = getSortQuery($value, $preparedParams);
break;
}
}
}
//count database items for pagination
$query = "SELECT count(*) FROM Item " . $filter . " " . $sort;
if (count($preparedParams) > 0) {
$stmt = $db->prepare($query);
//error_log(print_r($preparedParams, true));
$stmt->execute($preparedParams);
$count = $stmt->fetchColumn();
} else {
$count = $db->query($query)->fetchColumn();
}
//init pagination query
if ($pagingStatus) {
$paging = getPagingQuery($pagingStatus, $count, $preparedParams);
}
//init query with sort and filter
$query = "SELECT title, description, image, likes, keyword1, keyword2 FROM Item " . $filter . " " . $sort . " " . $paging;
if (count($preparedParams) > 0) {
$stmt = $db->prepare($query);
$stmt->execute($preparedParams);
$items = $stmt->fetchAll();
} else {
$items = $db->query($query);
}
foreach ($items as $item) {
$html .= getHTML($item);
}
//print html
echo getHTMLWrapper($html, $count);
//close the database connection
$db = NULL;
} catch (PDOException $ex) {
print 'Exception: ' . $ex->getMessage();
}
}
示例13: while
<?php
/*
Stap3:
Het dowlaoden van alle posts en op te slaan
*/
//Open de csv waar de links in staan
if ($cvs = fopen("postList.csv", "r")) {
//Voor elke relge gevodne in csv haal data op
while ($data = fgetcsv($cvs, 1000, ",")) {
//Haal de html op
getHTML($data[1]);
//Als er geen data gevodnen is geef een error
if (!$html) {
echo "There is no data found on this page\n";
} else {
//Open de locatie waar je het bestand wil opslaan en maar het bestand aan met als bestan naam de laaste gedeelte van de link
$file = fopen('/var/www/test/bayw/allPost/' . str_replace($data[1], "", "site naam"), 'w');
//Zet de html in het bestand
fputs($file, $html);
//sluit bestand
fclose($file);
}
//Vertraag het script voor 2 sec om overload te voor komen
sleep(2);
}
//sluit de csv
fclose($cvs);
}
示例14: create
function create($entity)
{
$html = getHTML($entity['source_url']);
if (!$html) {
return error_log('Could not import ' + $entity['source_url']);
}
// Clean title
$entity['title'] = trim(html_entity_decode($entity['title'], ENT_COMPAT, 'UTF-8'));
// Generate key
$entity['key'] = 'ch/' . makeSlug($entity['title']);
// Extract email
$emailLink = $html->find('table.tabelleESK a[href^=mailto:]', 0);
if ($emailLink) {
$entity['email'] = str_replace('mailto:', '', trim($emailLink->href));
}
// Extract URL
foreach ($html->find('table.tabelleESK tr') as $row) {
$name = trim($row->children(0)->innertext);
if (stripos('homepage', $name) !== false) {
foreach ($row->children() as $i => $cell) {
$link = $cell->find('a[href]', 0);
if ($link) {
$entity['url'] = $link->href;
break;
}
// Ugly case: URL but no link
if ($i && !$cell->children()) {
$entity['url'] = $cell->innertext;
break;
}
}
}
}
// Find entity abbreviation
$orgTitle = $html->find('h2.titleOrg', 0);
if ($orgTitle) {
$orgTitleParts = explode('-', $orgTitle->innertext);
if (count($orgTitleParts) > 1) {
$entity['abbr'] = trim(array_pop($orgTitleParts));
$entity['abbr'] = html_entity_decode($entity['abbr'], ENT_COMPAT, 'UTF-8');
}
} else {
error_log('No title on ' + $entity['source_url']);
}
// Find entity address
$infoBlock = $html->find('div.infoblock', 0)->innertext;
if (preg_match('/<\\/h2>(.+?)<div class="titleContent">/s', $infoBlock, $matches)) {
$infoBlock = str_replace(array('<br>', '(neues Fenster)'), array(', ', ''), $matches[1]);
$infoBlock = preg_replace('/\\s\\s+/', ' ', $infoBlock);
$infoBlock = trim(html_entity_decode(strip_tags($infoBlock), ENT_COMPAT, 'UTF-8'));
$entity['address'] = $infoBlock;
}
save($entity);
getChildren($entity, $html);
}
示例15: init
function init()
{
if (empty($_POST['letters']) || empty($_POST['wordlen'])) {
$html = getHTML(1);
} else {
$letters = trim($_POST['letters']);
//Remove spaces in between
$letters = strtolower(str_replace(' ', '', $letters));
$wordlen = intval($_POST['wordlen']);
if ($wordlen <= strlen($letters)) {
$success = getMatches($letters, $wordlen);
$html = getHTML(0, $success);
} else {
$success = array();
$html = getHTML(0, $success);
}
}
echo $html;
}