本文整理汇总了PHP中fetch_url函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_url函数的具体用法?PHP fetch_url怎么用?PHP fetch_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: directory_run
function directory_run(&$argv, &$argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "include/dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
load_config('config');
load_config('system');
if ($argc != 2) {
return;
}
load_config('system');
load_hooks();
$a->set_baseurl(get_config('system', 'url'));
$dir = get_config('system', 'directory_submit_url');
if (!strlen($dir)) {
return;
}
$arr = array('url' => $argv[1]);
call_hooks('globaldir_update', $arr);
logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
if (strlen($arr['url'])) {
fetch_url($dir . '?url=' . bin2hex($arr['url']));
}
return;
}
开发者ID:rahmiyildiz,项目名称:friendica,代码行数:32,代码来源:directory.php
示例2: directory_run
function directory_run($argv, $argc)
{
global $a, $db;
if (is_null($a)) {
$a = new App();
}
if (is_null($db)) {
@(include ".htconfig.php");
require_once "dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
}
load_config('config');
load_config('system');
if ($argc != 2) {
return;
}
load_config('system');
$a->set_baseurl(get_config('system', 'url'));
$dir = get_config('system', 'directory_submit_url');
if (!strlen($dir)) {
return;
}
fetch_url($dir . '?url=' . bin2hex($argv[1]));
return;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:26,代码来源:directory.php
示例3: privacy_image_cache_init
function privacy_image_cache_init()
{
$urlhash = 'pic:' . sha1($_REQUEST['url']);
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' LIMIT 1", $urlhash);
if (count($r)) {
$img_str = $r[0]['data'];
$mime = $r[0]["desc"];
if ($mime == "") {
$mime = "image/jpeg";
}
} else {
require_once "Photo.php";
$img_str = fetch_url($_REQUEST['url'], true);
if (substr($img_str, 0, 6) == "GIF89a") {
$mime = "image/gif";
$image = @imagecreatefromstring($img_str);
if ($image === FALSE) {
die;
}
q("INSERT INTO `photo`\n\t\t\t( `uid`, `contact-id`, `guid`, `resource-id`, `created`, `edited`, `filename`, `album`, `height`, `width`, `desc`, `data`, `scale`, `profile`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid` )\n\t\t\tVALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' )", 0, 0, get_guid(), dbesc($urlhash), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(basename(dbesc($_REQUEST["url"]))), dbesc(''), intval(imagesy($image)), intval(imagesx($image)), 'image/gif', dbesc($img_str), 100, intval(0), dbesc(''), dbesc(''), dbesc(''), dbesc(''));
} else {
$img = new Photo($img_str);
if ($img->is_valid()) {
$img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100);
$img_str = $img->imageString();
}
$mime = "image/jpeg";
}
}
header("Content-type: {$mime}");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600 * 24) . " GMT");
header("Cache-Control: max-age=" . 3600 * 24);
echo $img_str;
killme();
}
开发者ID:robhell,项目名称:friendica-addons,代码行数:35,代码来源:privacy_image_cache.php
示例4: leistungsschutzrecht_fetchsites
function leistungsschutzrecht_fetchsites()
{
require_once "include/network.php";
$sites = array();
$url = "http://www.vg-media.de/lizenzen/digitale-verlegerische-angebote/wahrnehmungsberechtigte-digitale-verlegerische-angebote.html";
$site = fetch_url($url);
$doc = new DOMDocument();
@$doc->loadHTML($site);
$xpath = new DomXPath($doc);
$list = $xpath->query("//td/a");
foreach ($list as $node) {
$attr = array();
if ($node->attributes->length) {
foreach ($node->attributes as $attribute) {
$attr[$attribute->name] = $attribute->value;
}
}
if (isset($attr["href"])) {
$urldata = parse_url($attr["href"]);
if (isset($urldata["host"]) and !isset($urldata["path"])) {
$cleanedurlpart = explode("%", $urldata["host"]);
$hostname = explode(".", $cleanedurlpart[0]);
$site = $hostname[sizeof($hostname) - 2] . "." . $hostname[sizeof($hostname) - 1];
$sites[$site] = $site;
}
}
}
if (sizeof($sites)) {
set_config('leistungsschutzrecht', 'sites', $sites);
}
}
开发者ID:swathe,项目名称:friendica-addons,代码行数:31,代码来源:leistungsschutzrecht.php
示例5: oexchange_content
function oexchange_content(&$a)
{
if (!local_user()) {
$o = login(false);
return $o;
}
if ($a->argc > 1 && $a->argv[1] === 'done') {
info(t('Post successful.') . EOL);
return;
}
$url = x($_GET, 'url') && strlen($_GET['url']) ? urlencode(notags(trim($_GET['url']))) : '';
$title = x($_GET, 'title') && strlen($_GET['title']) ? '&title=' . urlencode(notags(trim($_GET['title']))) : '';
$description = x($_GET, 'description') && strlen($_GET['description']) ? '&description=' . urlencode(notags(trim($_GET['description']))) : '';
$tags = x($_GET, 'tags') && strlen($_GET['tags']) ? '&tags=' . urlencode(notags(trim($_GET['tags']))) : '';
$s = fetch_url($a->get_baseurl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if (!strlen($s)) {
return;
}
require_once 'include/html2bbcode.php';
$post = array();
$post['profile_uid'] = local_user();
$post['return'] = '/oexchange/done';
$post['body'] = html2bbcode($s);
$post['type'] = 'wall';
$_POST = $post;
require_once 'mod/item.php';
item_post($a);
}
开发者ID:nphyx,项目名称:friendica,代码行数:28,代码来源:oexchange.php
示例6: dirfind_content
function dirfind_content(&$a)
{
$search = notags(trim($_REQUEST['search']));
if (strpos($search, '@') === 0) {
$search = substr($search, 1);
}
$o = '';
$o .= '<h2>' . t('People Search') . ' - ' . $search . '</h2>';
if ($search) {
$p = $a->pager['page'] != 1 ? '&p=' . $a->pager['page'] : '';
if (strlen(get_config('system', 'directory_submit_url'))) {
$x = fetch_url('http://dir.friendica.com/lsearch?f=' . $p . '&search=' . urlencode($search));
}
//TODO fallback local search if global dir not available.
// else
// $x = post_url($a->get_baseurl() . '/lsearch', $params);
$j = json_decode($x);
if ($j->total) {
$a->set_pager_total($j->total);
$a->set_pager_itemspage($j->items_page);
}
if (count($j->results)) {
$tpl = get_markup_template('match.tpl');
foreach ($j->results as $jj) {
$o .= replace_macros($tpl, array('$url' => zrl($jj->url), '$name' => $jj->name, '$photo' => $jj->photo, '$tags' => $jj->tags));
}
} else {
info(t('No matches') . EOL);
}
}
$o .= '<div class="clear"></div>';
$o .= paginate($a);
return $o;
}
开发者ID:jzacman,项目名称:friendica,代码行数:34,代码来源:dirfind.php
示例7: getWeather
function getWeather($loc, $units = 'metric', $lang = 'en', $appid = '', $cachetime = 0)
{
$url = "http://api.openweathermap.org/data/2.5/weather?q=" . $loc . "&appid=" . $appid . "&lang=" . $lang . "&units=" . $units . "&mode=xml";
$cached = Cache::get('curweather' . md5($url));
$now = new DateTime();
if (!is_null($cached)) {
$cdate = get_pconfig(local_user(), 'curweather', 'last');
$cached = unserialize($cached);
if ($cdate + $cachetime > $now->getTimestamp()) {
return $cached;
}
}
try {
$res = new SimpleXMLElement(fetch_url($url));
} catch (Exception $e) {
info(t('Error fetching weather data.\\nError was: ' . $e->getMessage()));
return false;
}
if ((string) $res->temperature['unit'] === 'metric') {
$tunit = '°C';
$wunit = 'm/s';
} else {
$tunit = '°F';
$wunit = 'mph';
}
if (trim((string) $res->weather['value']) == trim((string) $res->clouds['name'])) {
$desc = (string) $res->clouds['name'];
} else {
$desc = (string) $res->weather['value'] . ', ' . (string) $res->clouds['name'];
}
$r = array('city' => (string) $res->city['name'][0], 'country' => (string) $res->city->country[0], 'lat' => (string) $res->city->coord['lat'], 'lon' => (string) $res->city->coord['lon'], 'temperature' => (string) $res->temperature['value'][0] . $tunit, 'pressure' => (string) $res->pressure['value'] . (string) $res->pressure['unit'], 'humidity' => (string) $res->humidity['value'] . (string) $res->humidity['unit'], 'descripion' => $desc, 'wind' => (string) $res->wind->speed['name'] . ' (' . (string) $res->wind->speed['value'] . $wunit . ')', 'update' => (string) $res->lastupdate['value'], 'icon' => (string) $res->weather['icon']);
set_pconfig(local_user(), 'curweather', 'last', $now->getTimestamp());
Cache::set('curweather' . md5($url), serialize($r), CACHE_HOUR);
return $r;
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:35,代码来源:curweather.php
示例8: checkUpdate
function checkUpdate()
{
$r = fetch_url(APIBASE . "json/repos/show/" . F9KREPO . "/tags");
$tags = json_decode($r);
$tag = 0.0;
foreach ($tags->tags as $i => $v) {
$i = (double) $i;
if ($i > $tag) {
$tag = $i;
}
}
if ($tag == 0.0) {
return false;
}
$f = fetch_url("https://raw.github.com/" . F9KREPO . "/" . $tag . "/boot.php", "r");
preg_match("|'FRIENDICA_VERSION', *'([^']*)'|", $f, $m);
$version = $m[1];
$lv = explode(".", FRIENDICA_VERSION);
$rv = explode(".", $version);
foreach ($lv as $i => $v) {
if ((int) $lv[$i] < (int) $rv[$i]) {
return array($tag, $version, "https://github.com/friendica/friendica/zipball/" . $tag);
break;
}
}
return false;
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:27,代码来源:remoteupdate.php
示例9: scale_diaspora_images
function scale_diaspora_images($s, $include_link = true)
{
$matches = null;
$c = preg_match_all('/\\[img\\](.*?)\\[\\/img\\]/ism', $s, $matches, PREG_SET_ORDER);
if ($c) {
require_once 'include/Photo.php';
foreach ($matches as $mtch) {
logger('scale_diaspora_image: ' . $mtch[1]);
$i = fetch_url($mtch[1]);
if ($i) {
$ph = new Photo($i);
if ($ph->is_valid()) {
if ($ph->getWidth() > 600 || $ph->getHeight() > 600) {
$ph->scaleImage(600);
$new_width = $ph->getWidth();
$new_height = $ph->getHeight();
logger('scale_diaspora_image: ' . $new_width . 'w ' . $new_height . 'h' . 'match: ' . $mtch[0], LOGGER_DEBUG);
$s = str_replace($mtch[0], '[img=' . $new_width . 'x' . $new_height . ']' . $mtch[1] . '[/img]' . "\n" . ($include_link ? '[url=' . $mtch[1] . ']' . t('view full size') . '[/url]' . "\n" : ''), $s);
logger('scale_diaspora_image: new string: ' . $s, LOGGER_DEBUG);
}
}
}
}
}
return $s;
}
开发者ID:ryivhnn,项目名称:friendica,代码行数:26,代码来源:bb2diaspora.php
示例10: fortunate_fetch
function fortunate_fetch(&$a, &$b)
{
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
if (FORTUNATE_SERVER != 'hostname.com') {
$s = fetch_url('http://' . FORTUNATE_SERVER . '/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
$b .= '<div class="fortunate">' . $s . '</div>';
}
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:8,代码来源:fortunate.php
示例11: getCryptsyTicker
function getCryptsyTicker($marketid)
{
$res = fetch_url("http://pubapi.cryptsy.com/api.php?method=singleorderdata&marketid={$marketid}");
if (!$res) {
return null;
}
$ticker = json_decode($res);
return $ticker;
}
开发者ID:Excalibur201010,项目名称:yiimp,代码行数:9,代码来源:cryptsy_trading.php
示例12: dfrn_poll_init
function dfrn_poll_init(&$a)
{
$dfrn_id = '';
if (x($_GET, 'dfrn_id')) {
$dfrn_id = $a->config['dfrn_poll_dfrn_id'] = $_GET['dfrn_id'];
}
if (x($_GET, 'type')) {
$type = $a->config['dfrn_poll_type'] = $_GET['type'];
}
if (x($_GET, 'last_update')) {
$last_update = $a->config['dfrn_poll_last_update'] = $_GET['last_update'];
}
$dfrn_version = x($_GET, 'dfrn_version') ? $_GET['dfrn_version'] : '1.0';
$destination_url = x($_GET, 'destination_url') ? $_GET['destination_url'] : '';
if ($dfrn_id == '' && !x($_POST, 'dfrn_id') && $a->argc > 1) {
$o = get_feed_for($a, '*', $a->argv[1], $last_update);
echo $o;
killme();
}
if (x($type) && $type == 'profile') {
$r = q("SELECT `contact`.*, `user`.`nickname` \n\t\t\tFROM `contact` LEFT JOIN `user` ON `user`.`uid` = 1\n\t\t\tWHERE ( `dfrn-id` = '%s' OR ( `issued-id` = '%s' AND `duplex` = 1 )) LIMIT 1", dbesc($dfrn_id), dbesc($dfrn_id));
if (count($r)) {
$s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $dfrn_id . '&type=profile-check');
if (strlen($s)) {
$xml = simplexml_load_string($s);
if ((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1;
$_SESSION['visitor_id'] = $r[0]['id'];
notice(t('Hi ') . $r[0]['name'] . EOL);
// Visitors get 1 day session.
$session_id = session_id();
$expire = time() + 86400;
q("UPDATE `session` SET `expire` = '%s' WHERE `sid` = '%s' LIMIT 1", dbesc($expire), dbesc($session_id));
}
}
$profile = $r[0]['nickname'];
goaway(strlen($destination_url) ? $destination_url : $a->get_baseurl() . '/profile/' . $profile);
}
goaway($a->get_baseurl());
}
if (x($type) && $type == 'profile-check') {
q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
$r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC", dbesc($dfrn_id));
if (count($r)) {
xml_status(1);
return;
// NOTREACHED
}
xml_status(0);
return;
// NOTREACHED
}
}
开发者ID:vishalp,项目名称:MistparkPE-Remix,代码行数:53,代码来源:dfrn_poll.php
示例13: get_salmon_key
function get_salmon_key($uri, $keyhash)
{
$ret = array();
logger('Fetching salmon key for ' . $uri);
$arr = lrdd($uri);
if (is_array($arr)) {
foreach ($arr as $a) {
if ($a['@attributes']['rel'] === 'magic-public-key') {
$ret[] = $a['@attributes']['href'];
}
}
} else {
return '';
}
// We have found at least one key URL
// If it's inline, parse it - otherwise get the key
if (count($ret)) {
for ($x = 0; $x < count($ret); $x++) {
if (substr($ret[$x], 0, 5) === 'data:') {
if (strstr($ret[$x], ',')) {
$ret[$x] = substr($ret[$x], strpos($ret[$x], ',') + 1);
} else {
$ret[$x] = substr($ret[$x], 5);
}
} else {
$ret[$x] = fetch_url($ret[$x]);
}
}
}
logger('Key located: ' . print_r($ret, true));
if (count($ret) == 1) {
// We only found one one key so we don't care if the hash matches.
// If it's the wrong key we'll find out soon enough because
// message verification will fail. This also covers some older
// software which don't supply a keyhash. As long as they only
// have one key we'll be right.
return $ret[0];
} else {
foreach ($ret as $a) {
$hash = base64url_encode(hash('sha256', $a));
if ($hash == $keyhash) {
return $a;
}
}
}
return '';
}
开发者ID:ZerGabriel,项目名称:friendica,代码行数:47,代码来源:salmon.php
示例14: oembed_fetch_url
function oembed_fetch_url($embedurl)
{
$a = get_app();
$txt = Cache::get($a->videowidth . $embedurl);
// These media files should now be caught in bbcode.php
// left here as a fallback in case this is called from another source
$noexts = array("mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm");
$ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION);
if (is_null($txt)) {
$txt = "";
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$redirects = 0;
$html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
if ($html_text) {
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$xpath = new DOMXPath($dom);
$attr = "oembed";
$xattr = oe_build_xpath("class", "oembed");
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode("href")->nodeValue;
$txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
break;
}
}
}
}
if ($txt == false || $txt == "") {
// try oohembed service
$ourl = "http://oohembed.com/oohembed/?url=" . urlencode($embedurl) . '&maxwidth=' . $a->videowidth;
$txt = fetch_url($ourl);
}
$txt = trim($txt);
if ($txt[0] != "{") {
$txt = '{"type":"error"}';
}
//save in cache
Cache::set($a->videowidth . $embedurl, $txt);
}
$j = json_decode($txt);
$j->embedurl = $embedurl;
return $j;
}
开发者ID:ridcully,项目名称:friendica,代码行数:45,代码来源:oembed.php
示例15: geocoordinates_resolve_item
function geocoordinates_resolve_item(&$item)
{
if (!$item["coord"] || $item["location"]) {
return;
}
$key = get_config("geocoordinates", "api_key");
if ($key == "") {
return;
}
$language = get_config("geocoordinates", "language");
if ($language == "") {
$language = "de";
}
$coords = explode(' ', $item["coord"]);
if (count($coords) < 2) {
return;
}
$coords[0] = round($coords[0], 5);
$coords[1] = round($coords[1], 5);
$result = Cache::get("geocoordinates:" . $language . ":" . $coords[0] . "-" . $coords[1]);
if (!is_null($result)) {
$item["location"] = $result;
return;
}
$s = fetch_url("https://api.opencagedata.com/geocode/v1/json?q=" . $coords[0] . "," . $coords[1] . "&key=" . $key . "&language=" . $language);
if (!$s) {
logger("API could not be queried", LOGGER_DEBUG);
return;
}
$data = json_decode($s);
if ($data->status->code != "200") {
logger("API returned error " . $data->status->code . " " . $data->status->message, LOGGER_DEBUG);
return;
}
if ($data->total_results == 0 or count($data->results) == 0) {
logger("No results found for coordinates " . $item["coord"], LOGGER_DEBUG);
return;
}
$item["location"] = $data->results[0]->formatted;
logger("Got location for coordinates " . $coords[0] . "-" . $coords[1] . ": " . $item["location"], LOGGER_DEBUG);
if ($item["location"] != "") {
Cache::set("geocoordinates:" . $language . ":" . $coords[0] . "-" . $coords[1], $item["location"]);
}
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:44,代码来源:geocoordinates.php
示例16: parse_url_content
function parse_url_content(&$a)
{
$url = trim($_GET['url']);
$template = "<a href=\"%s\" >%s</a>%s";
if ($url) {
$s = fetch_url($url);
} else {
echo '';
killme();
}
if (!$s) {
echo sprintf($template, $url, $url, '');
killme();
}
$dom = HTML5_Parser::parse($s);
if (!$dom) {
return $ret;
}
$items = $dom->getElementsByTagName('title');
if ($items) {
foreach ($items as $item) {
$title = $item->textContent;
break;
}
}
$items = $dom->getElementsByTagName('p');
if ($items) {
foreach ($items as $item) {
$text = $item->textContent;
$text = strip_tags($text);
if (strlen($text) < 100) {
continue;
}
$text = substr($text, 0, 250) . '...';
break;
}
}
if (strlen($text)) {
$text = '<br />' . $text;
}
echo sprintf($template, $url, $title, $text);
killme();
}
开发者ID:vishalp,项目名称:MistparkPE-Remix,代码行数:43,代码来源:parse_url.php
示例17: fetch_page
function fetch_page($page_url)
{
$html = fetch_url($page_url);
// echo $html;
if (!preg_match_all('%<img src="([^"]+.douban.com/view/group_topic/large/public/p\\d+.jpg)"%i', $html, $matches)) {
echo "no image in this page\n";
return false;
}
foreach ($matches[1] as $image_url) {
$file_name = substr($image_url, strrpos($image_url, '/') + 1);
$file_name = __DIR__ . '/images/' . $file_name;
if (is_file($file_name)) {
echo "skip {$file_name}\n";
continue;
}
echo "save {$file_name} \n";
image_save($file_name, $image_url);
}
return count($matches[1]);
}
开发者ID:picasso250,项目名称:image-fetch,代码行数:20,代码来源:douban.php
示例18: oembed_fetch_url
function oembed_fetch_url($embedurl)
{
$txt = Cache::get($embedurl);
$noexts = array("mp3", "mp4", "ogg", "ogv", "oga", "ogm", "webm");
$ext = pathinfo(strtolower($embedurl), PATHINFO_EXTENSION);
if (is_null($txt)) {
$txt = "";
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$redirects = 0;
$html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
if ($html_text) {
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$xpath = new DOMXPath($dom);
$attr = "oembed";
$xattr = oe_build_xpath("class", "oembed");
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach ($entries as $e) {
$href = $e->getAttributeNode("href")->nodeValue;
$txt = fetch_url($href);
}
}
}
}
if ($txt == false || $txt == "") {
// try oohembed service
$ourl = "http://oohembed.com/oohembed/?url=" . urlencode($embedurl);
$txt = fetch_url($ourl);
}
$txt = trim($txt);
if ($txt[0] != "{") {
$txt = '{"type":"error"}';
}
//save in cache
Cache::set($embedurl, $txt);
}
$j = json_decode($txt);
$j->embedurl = $embedurl;
return $j;
}
开发者ID:nextgensh,项目名称:friendica,代码行数:41,代码来源:oembed.php
示例19: fetch
/**
* Fetches an update file and verifies its authenticity before returning
* the file contents. Returns false on failure.
*/
public static function fetch($path)
{
self::$error = false;
$file_url = self::$updates . $path;
$sha_url = self::$checksums . $path . '.sha';
$file = fetch_url($file_url);
if (!$file) {
self::$error = 'Unable to fetch file.';
return false;
}
$sha = fetch_url($sha_url);
if (!$sha) {
self::$error = 'Unable to fetch checksum file.';
return false;
}
if (!self::test_checksum($file, $sha)) {
self::$error = 'Checksum failed!';
return false;
}
return $file;
}
开发者ID:Selwyn-b,项目名称:elefant,代码行数:25,代码来源:Updater.php
示例20: scrape_meta
function scrape_meta($url)
{
$ret = array();
$s = fetch_url($url);
if (!$s) {
return $ret;
}
$dom = HTML5_Parser::parse($s);
if (!$dom) {
return $ret;
}
$items = $dom->getElementsByTagName('meta');
// get DFRN link elements
foreach ($items as $item) {
$x = $item->getAttribute('name');
if (substr($x, 0, 5) == "dfrn-") {
$ret[$x] = $item->getAttribute('content');
}
}
return $ret;
}
开发者ID:vishalp,项目名称:MistparkPE-Remix,代码行数:21,代码来源:Scrape.php
注:本文中的fetch_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论