本文整理匯總了PHP中scraperwiki::httpresponseheader方法的典型用法代碼示例。如果您正苦於以下問題:PHP scraperwiki::httpresponseheader方法的具體用法?PHP scraperwiki::httpresponseheader怎麽用?PHP scraperwiki::httpresponseheader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scraperwiki
的用法示例。
在下文中一共展示了scraperwiki::httpresponseheader方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
<itunes:email>darkgiank@darkgiank.com</itunes:email>
</itunes:owner>
<?php
// .. CREACION DEL ARRAY
foreach ($data as $item) {
echo " <item>\n";
echo " <title>" . $item['artist'] . " - " . $item['title'] . "</title>\n";
echo " <enclosure url=\"" . $item['url'] . "\" type=\"audio/mpeg\" />\n";
echo " <guid>" . $item['loved_count'] . "</guid>\n";
echo " </item>\n";
}
?>
</channel>
</rss><?php
scraperwiki::httpresponseheader('Content-Type', 'application/atom+xml');
scraperwiki::attach("exfm");
$data = scraperwiki::select("* from exfm.swdata");
?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>TuMusika Evolution Podcast</title>
<link>http://www.tumusika.net/</link>
<language>es-es</language>
<itunes:owner>
<itunes:name>TuMusika Evolution</itunes:name>
<itunes:email>darkgiank@darkgiank.com</itunes:email>
</itunes:owner>
<?php
示例2: date
//$s = scraperwiki::scrape($sourcescraper, $limit=250);
// = scraperwiki::attach($sourcescraper, $limit=250);
scraperwiki::attach('irish_president_engagementsjson');
$trips = scraperwiki::select("* from irish_president_engagementsjson.swdata where date > date('now','-7 day');");
$alltrips = array();
foreach ($trips as $trip) {
$tripinfo = $trip["info"];
$triplabel = $trip["label"];
$tripinfo = str_replace('(', '', $tripinfo);
$tripinfo = str_replace(')', ',', $tripinfo);
$triplabel = str_replace('(', '', $triplabel);
$triplabel = str_replace(')', ',', $triplabel);
//print $triplabel;
$trip["info"] = $tripinfo;
$trip["label"] = $triplabel;
$alltrips[] = $trip;
}
//header('Content-type: application/json');
scraperwiki::httpresponseheader('Content-Type', 'application/json', 'charset=utf8');
//print "{ \"items\": ".json_encode($alltrips) ."}";
$callback = $_GET['callback'];
if ($callback) {
header("Content-Type: text/javascript; charset=utf8");
echo $callback . "(" . json_encode($alltrips) . ");";
} else {
header("Content-type: application/json");
echo json_encode($alltrips);
}
// {label} {id} {type} {day} {date} {year} {time} {startdate} {latlng} {arasnotaras} {details} {place} {act} {issue} {constitutional} {destf} {address} {days} {destination}
?>
示例3: imagecreate
//Set the correct content type
scraperwiki::httpresponseheader("Content-Type", "image/gif");
//Create our basic image stream
//125px width, 125px height
$image = imagecreate(125, 125);
//Set the background color
$blue = imagecolorallocate($image, 0, 0, 255);
//Set up another color just to show how the first color declared is used as the background color when we use imagecreate()
//Notice how blue is applied to the background, *not* red.
$red = imagecolorallocate($image, 255, 0, 0);
//save the image as a png and output
imagepng($image);
//Clear up memory used
//imagedestroy($image);
//Report any errors
#ini_set ("display_errors", "1");
#error_reporting(E_ALL);
//Set the correct content type
scraperwiki::httpresponseheader("Content-Type", "image/gif");
//Create our basic image stream
//125px width, 125px height
$image = imagecreate(125, 125);
//Set the background color
$blue = imagecolorallocate($image, 0, 0, 255);
//Set up another color just to show how the first color declared is used as the background color when we use imagecreate()
//Notice how blue is applied to the background, *not* red.
$red = imagecolorallocate($image, 255, 0, 0);
//save the image as a png and output
imagepng($image);
//Clear up memory used
//imagedestroy($image);
示例4: array
$vevents = scraperwiki::select("* from ons_release_schedule_ical.vevents limit {$limit} offset {$offset}");
$icalevents = array();
foreach ($vevents as $vevent) {
$icalevent = "BEGIN:VEVENT\nDTSTAMP" . $vevent["DTSTAMP"] . "\nDTSTART" . $vevent["DTSTART"] . "\nX-TITLE:" . $vevent["Title"] . "\nSUMMARY:" . $vevent["Summary"] . "\nDESCRIPTION:Theme: " . $vevent["Theme"] . "\n" . $vevent["Summary"] . "\\nEND:VEVENT\n";
#print_r($icalevent);
$icalevents[] = $icalevent;
}
print "BEGIN:VCALENDAR\nMETHOD:PUBLISH\nVERSION:2.0\nX-WR-CALNAME:ONS Release Calendar\nPRODID:-//Apple Inc.//iCal 4.0.4//EN\nX-APPLE-CALENDAR-COLOR:#B027AE\nX-WR-TIMEZONE:Europe/London\nCALSCALE:GREGORIAN\n" . implode("", $icalevents) . "\nEND:VCALENDAR";
// Derive an ical string of 10 eventss
$querylist = explode("&", getenv("QUERY_STRING"));
$limit = 10;
$offset = 0;
foreach ($querylist as $queryl) {
$ql = explode("=", $queryl);
if ($ql[0] == "limit" && count($ql) == 2) {
$limit = intval($ql[1]);
}
if ($ql[0] == "offset" && count($ql) == 2) {
$offset = intval($ql[1]);
}
}
scraperwiki::httpresponseheader("Content-Type", "text/plain");
scraperwiki::attach('ons_release_schedule_ical');
$vevents = scraperwiki::select("* from ons_release_schedule_ical.vevents limit {$limit} offset {$offset}");
$icalevents = array();
foreach ($vevents as $vevent) {
$icalevent = "BEGIN:VEVENT\nDTSTAMP" . $vevent["DTSTAMP"] . "\nDTSTART" . $vevent["DTSTART"] . "\nX-TITLE:" . $vevent["Title"] . "\nSUMMARY:" . $vevent["Summary"] . "\nDESCRIPTION:Theme: " . $vevent["Theme"] . "\n" . $vevent["Summary"] . "\\nEND:VEVENT\n";
#print_r($icalevent);
$icalevents[] = $icalevent;
}
print "BEGIN:VCALENDAR\nMETHOD:PUBLISH\nVERSION:2.0\nX-WR-CALNAME:ONS Release Calendar\nPRODID:-//Apple Inc.//iCal 4.0.4//EN\nX-APPLE-CALENDAR-COLOR:#B027AE\nX-WR-TIMEZONE:Europe/London\nCALSCALE:GREGORIAN\n" . implode("", $icalevents) . "\nEND:VCALENDAR";
示例5: md5
<item>
<title>' . $date . ' - WAVD</title>
<description>' . $timeWAVD . '</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<guid>' . md5($date . $timeWAVD) . '</guid>
</item>
<item>
<title>' . $date . ' - GETTIN DIGGY</title>
<description>' . $timeDIGGY . '</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<guid>' . md5($date . $timeDIGGY) . '</guid>
</item>
</channel>
</rss>';
$sourcescraper = 'ossie_indoor_beach_volleyball_2';
scraperwiki::httpresponseheader('Content-Type', 'text/rss+xml');
scraperwiki::attach($sourcescraper);
$date = scraperwiki::get_var("date");
$timeWAVD = scraperwiki::get_var("timeWAVD");
$timeDIGGY = scraperwiki::get_var("timeDIGGY");
print '<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>Ossie Indoor Beach Volleyball Game Times</title>
<description>Feed of game times</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<item>
<title>' . $date . ' - WAVD</title>
<description>' . $timeWAVD . '</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<guid>' . md5($date . $timeWAVD) . '</guid>
示例6:
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
scraperwiki::httpresponseheader('Content-Type', 'text/plain');
//scraperwiki::httpresponseheader('Content-Type', 'text/html');
print "<h1>hi there</h1>\n";
示例7: explode
$querylist = explode("&", getenv("QUERY_STRING"));
$limit = 100;
$offset = 0;
foreach ($querylist as $queryl) {
$ql = explode("=", $queryl);
if ($ql[0] == "limit" && count($ql) == 2) {
$limit = intval($ql[1]);
}
if ($ql[0] == "offset" && count($ql) == 2) {
$offset = intval($ql[1]);
}
}
//scraperwiki::httpresponseheader("Content-Type", "text/plain");
scraperwiki::httpresponseheader("Content-Type", 'text/calendar');
//; charset=utf-8');
scraperwiki::httpresponseheader("Content-Disposition", "inline; filename=pres.ics");
scraperwiki::attach('irish_president_engagementstest');
# select * from swdata where birth_date < '2000-01-01' just most recentdate('now');
#$vevents = scraperwiki::select("* from irish_president_engagements.swdata limit $limit offset $offset");
$vevents = scraperwiki::select("* from irish_president_engagementstest.swdata where date > date('now','-7 day');");
$icalevents = array();
foreach ($vevents as $vevent) {
//date info place time
//= ":".date("Ymd")."T".date("His")."Z";
$vdate = $vevent["date"];
$vtime = $vevent["time"];
$vtime = str_replace(":", "", $vtime);
$CustomDATE = ":" . date("Ymd", strtotime($vdate)) . "T" . $vtime . "00Z";
$vinfo = $vevent["info"];
$vplace = $vevent["place"];
$vinfo = str_replace(',', '\\,', $vinfo);
示例8: str_replace
$writer->startElement('LineString');
//$writer->writeElement('extrude', '1');
$writer->writeElement('tessellate', '1');
$writer->writeElement('altitudeMode', 'clampToGround');
$coords = str_replace("\n", ';', $route['coords']);
$writer->writeElement('coordinates', $coords);
$writer->endElement();
//linestring
$writer->endElement();
//placemark
}
$writer->endElement();
//Document
$writer->endElement();
//kml
scraperwiki::httpresponseheader('Content-Type', 'text/xml; charset=utf-8');
//Scraper by Ændrew Rininsland, licensed openly. Uses data from Transport for London. Information wants to be free.
scraperwiki::attach("tfl_bus_route_aggregator", "src");
$routes = scraperwiki::select("route, coords from src.swdata order by id asc");
// THIS IS ABSOLUTELY ESSENTIAL - DO NOT FORGET TO SET THIS
@date_default_timezone_set("GMT");
$writer = new XMLWriter();
// Output directly to the user
$writer->openURI('php://output');
$writer->startDocument('1.0');
$writer->setIndent(4);
$writer->startElement('kml');
$writer->writeAttribute('xmlns', 'http://www.opengis.net/kml/2.2');
$writer->startElement('Document');
$writer->writeElement('name', 'Transport for London bus routes');
$writer->writeElement('description', 'Taken from TfL\'s bus routes feed, scraped once a month.');
示例9:
<description>'.$timeWAVD.'</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<guid>'.md5($date.$timeWAVD).'</guid>
</item>
<item>
<title>'.$date.' - GETTIN DIGGY</title>
<description>'.$timeDIGGY.'</description>
<link>http://www.ossieindoor.com.au/tuesday</link>
<guid>'.md5($date.$timeDIGGY).'</guid>
</item>
</channel>
</rss>'
);
*/
$sourcescraper = 'ossie_indoor_beach_volleyball_2';
scraperwiki::httpresponseheader('Content-Type', 'text/calendar');
scraperwiki::attach($sourcescraper);
$date = scraperwiki::get_var("date");
$timeWAVD = scraperwiki::get_var("timeWAVD");
$timeDIGGY = scraperwiki::get_var("timeDIGGY");
print "BEGIN:VCALENDAR\nPRODID:-//Google Inc//Google Calendar 70.9054//EN\nVERSION:2.0\nCALSCALE:GREGORIAN\nMETHOD:PUBLISH\nX-WR-CALNAME:TEST\nX-WR-TIMEZONE:Australia/Perth\nX-WR-CALDESC:\nBEGIN:VEVENT\nDTSTART:20121005T100000Z\nDTEND:20121005T110000Z\nDTSTAMP:20121004T023432Z\nUID:fqdkig4qvg7mnh8kkome3i979o@google.com\nCREATED:20121004T023324Z\nDESCRIPTION:\nLAST-MODIFIED:20121004T023400Z\nLOCATION:\nSEQUENCE:1\nSTATUS:CONFIRMED\nSUMMARY:TEST ITEM\nTRANSP:TRANSPARENT\nEND:VEVENT\nEND:VCALENDAR";
/*
print '<?xml version="1.0" encoding="UTF-8" ?>';
print '<rss version="2.0">';
print '<channel>';
print ' <title>Ossie Indoor Beach Volleyball Game Times</title>';
print ' <description>Feed of game times</description>';
print ' <link>http://www.ossieindoor.com.au/tuesday</link>';
print
示例10: time
$timestamp = time();
}
$date = date('Y-m-d\\TH:i:s', $timestamp);
$matches = array();
if (preg_match('/^([\\-+])(\\d{2})(\\d{2})$/', date('O', $timestamp), $matches)) {
$date .= $matches[1] . $matches[2] . ':' . $matches[3];
} else {
$date .= 'Z';
}
return $date;
}
# Blank PHP
$sourcescraper = 'tmp_dependspace';
$item = scraperwiki::select("* from swdata");
// ATOM published
scraperwiki::httpresponseheader("Content-Type", "application/atom+xml");
echo '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL;
echo '<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">' . PHP_EOL;
echo ' <title>DependSpace v.9 メーカーサイト更新情報、発売日情報サイト</title>' . PHP_EOL;
echo ' <subtitle type="text">DependSpace v.9 メーカーサイト更新情報、発売日情報サイト</subtitle>' . PHP_EOL;
echo ' <link rel="alternate" type="text/html" href="http://www.nona.dti.ne.jp/d-space/" />' . PHP_EOL;
echo ' <link rel="self" type="application/atom+xml" href="https://views.scraperwiki.com/run/dependspace_to_atom_feed_view/" />' . PHP_EOL;
echo ' <updated>' . date3339() . '</updated>' . PHP_EOL;
echo ' <id>tag:dependspace.net,' . date("Y") . ':' . date("m") . ':' . date("d") . '</id>' . PHP_EOL;
echo ' <link rel="start" href="https://views.scraperwiki.com/run/dependspace_to_atom_feed_view/" type="application/rss+xml"/>' . PHP_EOL;
foreach ($item as $key => $val) {
$val['text'] = htmlspecialchars($val['text'], ENT_QUOTES);
echo ' <entry>' . PHP_EOL;
echo ' <title>' . $val['text'] . '</title>' . PHP_EOL;
echo ' <link rel="alternate" type="text/html" href="' . $val['href'] . '" />' . PHP_EOL;
echo ' <id>tag:dependppace.net,' . date("Y") . ':feed/' . $val['id'] . '</id>' . PHP_EOL;
示例11: foreach
foreach ($dom->find("table[@class='plane'] tr") as $data) {
$tds = $data->find("td");
$links = $data->find("a");
//$record[] = array(
//$record = array(
// 'key' => $key,
// 'date' => $tds[0]->plaintext,
// 'title' => $links[0]->plaintext,
// 'link' => $links[0]->href
//);
//print_r($record);
scraperwiki::save_sqlite(array("key"), array("key" => $key, "date" => $tds[0]->plaintext, "title" => $links[0]->plaintext, "link" => $links[0]->href));
$key = $key + 1;
}
//scraperwiki::save_sqlite(array("key"),$record);
scraperwiki::httpresponseheader('Content-Type', 'text/html; charset=Shift_JIS');
$html = scraperWiki::scrape("http://www.u-tokyo.ac.jp/public/public01_02_2011_j.html");
require 'scraperwiki/simple_html_dom.php';
$dom = new simple_html_dom();
$dom->load($html);
$key = 1;
foreach ($dom->find("table[@class='plane'] tr") as $data) {
$tds = $data->find("td");
$links = $data->find("a");
//$record[] = array(
//$record = array(
// 'key' => $key,
// 'date' => $tds[0]->plaintext,
// 'title' => $links[0]->plaintext,
// 'link' => $links[0]->href
//);