本文整理匯總了PHP中scraperwiki::getData方法的典型用法代碼示例。如果您正苦於以下問題:PHP scraperwiki::getData方法的具體用法?PHP scraperwiki::getData怎麽用?PHP scraperwiki::getData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scraperwiki
的用法示例。
在下文中一共展示了scraperwiki::getData方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getenv
}
?>
</p>
<?php
$sourcescraper = 'oregon_business_registry';
$keys = scraperwiki::getKeys($sourcescraper);
$keyindex = getenv("URLQUERY");
if ($keyindex == False) {
$keyindex = 1;
}
$key = $keys[$keyindex];
$counts = array();
$s = scraperwiki::getData($sourcescraper);
foreach ($s as $c => $row) {
foreach ($row as $k => $value) {
if ($k == $key) {
if ($key == 'registered_date') {
$year = substr($value, 6, 4);
if (!$year) {
continue;
}
if (!array_key_exists($year, $counts)) {
$counts[$year] = 0;
}
$counts[$year] += 1;
} else {
if (!$key) {
continue;
示例2: getenv
}
?>
</p>
<?php
$sourcescraper = 'vca-car-fuel-data';
$keys = scraperwiki::getKeys($sourcescraper);
$keyindex = getenv("URLQUERY");
if ($keyindex == False) {
$keyindex = 4;
}
$key = $keys[$keyindex];
$counts = array();
$s = scraperwiki::getData($sourcescraper, $limit = 250);
foreach ($s as $c => $row) {
foreach ($row as $k => $value) {
if ($k == $key) {
if (!array_key_exists($value, $counts)) {
$counts[$value] = 0;
}
$counts[$value] += 1;
}
}
}
?>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
示例3: print_r
print_r($graph);
$total_percentage = $total_malicious / $total_incidents * 100;
print 'Percentage of malicious across all incindents ' . $total_percentage . '%';
?>
</script>
<?php
# Blank PHP
$sourcescraper = 'central_scotland_fire_incidents';
$keys = scraperwiki::getKeys($sourcescraper);
print_r($keys);
$keyindex = getenv("URLQUERY");
//print_r($keyindex);
$all_data = scraperwiki::getData($sourcescraper, $limit = 10000);
//print_r($all_data);
$is_malicious = FALSE;
$results = array();
$total_malicious = 0;
$total_incidents = 0;
foreach ($all_data as $item) {
$total_incidents++;
$location = $item->location;
$location = explode(',', $location);
$location = trim($location[1]);
$regex_malicious = '@malicious@';
//$regex_false_alarm = '@false alarm@';
$summary = $item->summary;
$is_malicious = preg_match($regex_malicious, $summary);
//&& preg_match($regex_false_alarm, $summary));
示例4: unset
}
$i = $i + 1;
}
#dealloco il dom sennò schianta
$dom->clear();
unset($dom);
}
######################################
# Scraper Scuole Italiane (Susanna Martinelli)
######################################
require 'scraperwiki/simple_html_dom.php';
$prov_marche = array("ANCONA", "ASCOLI%20PICENO", "MACERATA", "PESARO");
$tipologie = array("CENTRO%20TERRITORIALE%20PERMANENTE", "CIRCOLO%20DIDATTICO", "CORSO%20SERALE", "ISTITUTO%20COMPRENSIVO", "ISTITUTO%20DI%20ISTRUZIONE%20SUPERIORE", "SCUOLA%20DELL'INFANZIA", "SCUOLA%20PRIMARIA", "SCUOLA%20SECONDARIA%20DI%20I%20GRADO", "SCUOLA%20SECONDARIA%20DI%20II%20GRADO");
# Use the PHP Simple HTML DOM Parser to extract <td> tags
$main_url = "http://www.trampi.istruzione.it/ricScu/cerca.do?";
$rows = scraperwiki::getData("scuole_marche", -1, 0);
$count = count($rows);
$last_row = $rows[$count - 1];
$last_tipe = $last_row->tipologia;
$last_prov = $last_row->provincia;
#$dom ->clear();
#unset($dom);
foreach ($tipologie as $tipo) {
foreach ($prov_marche as $prov) {
$url = $main_url . "regione=MARCHE&provincia=" . $prov . "&comune=&tipologia=" . $tipo . "&denominazione=&codicemecc=&order=DES_NOM";
print $url . "\n";
$html = scraperwiki::scrape($url);
create_dataset2($html);
}
}
function create_dataset2($html)
示例5: unset
$i = $i + 1;
}
#dealloco il dom sennò schianta
$dom->clear();
unset($dom);
}
}
######################################
# Scraper Scuole Italiane (Susanna Martinelli)
######################################
require 'scraperwiki/simple_html_dom.php';
$prov_veneto = array("BELLUNO", "PADOVA", "ROVIGO", "TREVISO", "VENEZIA", "VERONA", "VICENZA");
$tipologie = array("CENTRO TERRITORIALE PERMANENTE", "CIRCOLO DIDATTICO", "CORSO SERALE", "ISTITUTO COMPRENSIVO", "ISTITUTO DI ISTRUZIONE SUPERIORE", "SCUOLA DELL'INFANZIA", "SCUOLA PRIMARIA", "SCUOLA SECONDARIA DI I GRADO", "SCUOLA SECONDARIA DI II GRADO");
# Use the PHP Simple HTML DOM Parser to extract <td> tags
$main_url = "http://www.trampi.istruzione.it/ricScu/cerca.do?";
$rows = scraperwiki::getData("scuole_veneto", 1, 0);
$last_record = $rows[0];
print_r($last_record);
$last_tipo = $last_record->tipologia;
$last_tipo = strtoupper(trim($last_tipo));
$last_provincia = $last_record->provincia;
$last_provincia = strtoupper(trim($last_provincia));
$found_tipo = false;
$found_prov = false;
print "Ultimo record trovato: tipo" . $last_tipo . " regione: " . $last_regione . " provincia: " . $last_provincia;
#$dom ->clear();
#unset($dom);
foreach ($tipologie as $tipo) {
echo "tipo:" . $tipo . " last_tipo: " . $last_tipo . strcmp($tipo, $last_tipo) . "\n";
if (strcmp($tipo, $last_tipo) == 0 || $found_tipo) {
$found_tipo = true;
示例6: e
</script>
</head>
<body>
<div id="feedicon"><a href="http://lab.linkeddata.deri.ie/2010/planning-apps/feed"><img src="http://lab.linkeddata.deri.ie/2010/planning-apps/feed-icon-28x28.png" alt="RSS feed" title="Subscribe to RSS feed" /></a></div>
<h1>Recent planning applications to Galway City Council <small id="message">...</small></h1>
<p>Based on planning data from
<a href="http://www.galwaycity.ie/AllServices/Planning/">Galway City Council</a>,
extracted and visualised with
<a href="http://scraperwiki.com/scrapers/latest-galway-city-planning-applications/">ScraperWiki</a>.</p>
</div>
<div id="map"></div>
<?php
$sourcescraper = 'latest-galway-city-planning-applications';
$applications = scraperwiki::getData($sourcescraper);
function e($s)
{
echo htmlspecialchars($s);
}
foreach ($applications as $app) {
?>
<h2><a href="<?php
e($app->url);
?>
">#<?php
e($app->appref);
?>
: <?php
e($app->address);
?>
示例7: array
$prov_piemonte = array("ALESSANDRIA", "ASTI", "BIELLA", "CUNEO", "NOVARA", "TORINO", "VERBANO-CUSIO-OSSOLA", "VERCELLI");
$prov_lazio = array("FROSINONE", "LATINA", "RIETI", "ROMA", "VITERBO");
$prov_abruzzo = array("CHIETI", "L'AQUILA", "PESCARA", "TERAMO");
$prov_molise = array("CAMPOBASSO", "ISERNIA");
$prov_umbria = array("PERUGIA", "TERNI");
$prov_trentino = array("TRENTO");
$prov_basilicata = array("MATERA", "POTENZA");
$regioni = array("TOSCANA" => $prov_toscana, "CALABRIA" => $prov_calabria, "VENETO" => $prov_veneto, "MARCHE" => $prov_marche, "LOMBARDIA" => $prov_lombardia, "SARDEGNA" => $prov_sardegna, "SICILIA" => $prov_sicilia, "PUGLIA" => $prov_puglia, "FRIULI-VENEZIA " => $prov_friuliv, "LIGURIA" => $prov_liguria, "EMILIA ROMAGNA" => $prov_emilia_paranoica, "CAMPANIA" => $prov_campania, "PIEMONTE" => $prov_piemonte, "LAZIO" => $prov_lazio, "ABRUZZO" => $prov_abruzzo, "MOLISE" => $prov_molise, "UMBRIA" => $prov_umbria, "TRENTINO-ALTO A" => $prov_trentino, "BASILICATA" => $prov_basilicata);
$tipologie = array("CENTRO TERRITORIALE PERMANENTE", "CIRCOLO DIDATTICO", "CORSO SERALE", "ISTITUTO COMPRENSIVO", "ISTITUTO DI ISTRUZIONE SUPERIORE", "SCUOLA DELL'INFANZIA", "SCUOLA PRIMARIA", "SCUOLA SECONDARIA DI I GRADO", "SCUOLA SECONDARIA DI II GRADO");
# Use the PHP Simple HTML DOM Parser to extract <td> tags
$main_url = "http://www.trampi.istruzione.it/ricScu/cerca.do?";
$last_tipo = "";
$last_provincia = "";
$last_regione = "";
# se non funziona va cambiato in 'scuole_italiane'
$rows = scraperwiki::getData("scuole_italiane_p4", 1, 0);
if (isset($rows)) {
$last_record = $rows[0];
#print_r($last_record);
$last_tipo = $last_record->tipologia;
$last_tipo = strtoupper(trim($last_tipo));
$last_provincia = $last_record->provincia;
$last_provincia = strtoupper(trim($last_provincia));
$last_regione = $last_record->regione;
$last_regione = strtoupper(trim($last_regione));
print "Ultimo record trovato: tipo: " . $last_tipo . " regione: " . $last_regione . " provincia: " . $last_provincia . "\n";
$found_tipo = false;
$found_prov = false;
$found_regione = false;
} else {
$found_tipo = true;