本文整理匯總了PHP中scraperwiki::sw_dumpMessage方法的典型用法代碼示例。如果您正苦於以下問題:PHP scraperwiki::sw_dumpMessage方法的具體用法?PHP scraperwiki::sw_dumpMessage怎麽用?PHP scraperwiki::sw_dumpMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scraperwiki
的用法示例。
在下文中一共展示了scraperwiki::sw_dumpMessage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: errorHandler
function errorHandler($errno, $errstr, $errfile, $errline)
{
// if error has been surpressed with an @
// see: http://php.net/manual/en/function.set-error-handler.php
if (error_reporting() == 0) {
return;
}
global $script;
$etb = errorParserStack($errno, $errstr, $script);
scraperwiki::sw_dumpMessage($etb);
return true;
}
示例2: gb_postcode_to_latlng
static function gb_postcode_to_latlng($postcode)
{
if (is_null($postcode)) {
return null;
}
$ds = SW_DataStoreClass::create();
$result = $ds->postcodeToLatLng($postcode);
if (!$result[0]) {
scraperwiki::sw_dumpMessage(array('message_type' => 'console', 'content' => 'Warning: ' + sprintf('%s: %s', $result[1], $postcode)));
return null;
}
return $result[1];
}
示例3: save_sqlite
static function save_sqlite($unique_keys, $data, $table_name = "swdata", $verbose = 2)
{
$ds = SW_DataStoreClass::create();
if (count($data) == 0) {
return;
}
if (!array_key_exists(0, $data)) {
$data = array($data);
}
# convert special types
foreach ($data as &$row) {
foreach ($row as $key => &$value) {
if ($value instanceof DateTime) {
$new_value = clone $value;
$new_value->setTimezone(new DateTimeZone('UTC'));
$value = $new_value->format(DATE_ISO8601);
assert(strpos($value, "+0000") !== FALSE);
$value = str_replace("+0000", "", $value);
}
}
}
$result = $ds->request(array('maincommand' => 'save_sqlite', 'unique_keys' => $unique_keys, 'data' => $data, 'swdatatblname' => $table_name));
if (property_exists($result, 'error')) {
throw new Exception($result->error);
}
if ($verbose == 2) {
$sdata = $data[0];
$pdata = array();
foreach ($sdata as $key => $value) {
$pdata[scraperwiki::unicode_truncate($key, 50)] = scraperwiki::unicode_truncate($value, 50);
}
if (count($data) >= 2) {
$pdata["number_records"] = "Number Records: " . count($data);
}
scraperwiki::sw_dumpMessage(array('message_type' => 'data', 'content' => $pdata));
}
return $result;
}
示例4: array
$dict = array('message_type' => 'console', 'encoding' => "base64", 'content' => base64_encode($data));
scraperwiki::httpresponseheader("Content-Type", "image/png");
scraperwiki::sw_dumpMessage($dict);
$url = "http://scraperwiki.com/media/images/intro_slides/intro4.png";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
//print $data;
$dict = array('message_type' => 'console', 'encoding' => "base64", 'content' => base64_encode($data));
scraperwiki::httpresponseheader("Content-Type", "image/png");
scraperwiki::sw_dumpMessage($dict);
$url = "http://scraperwiki.com/media/images/intro_slides/intro4.png";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
//print $data;
$dict = array('message_type' => 'console', 'encoding' => "base64", 'content' => base64_encode($data));
scraperwiki::httpresponseheader("Content-Type", "image/png");
scraperwiki::sw_dumpMessage($dict);
$url = "http://scraperwiki.com/media/images/intro_slides/intro4.png";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
//print $data;
$dict = array('message_type' => 'console', 'encoding' => "base64", 'content' => base64_encode($data));
scraperwiki::httpresponseheader("Content-Type", "image/png");
scraperwiki::sw_dumpMessage($dict);