本文整理汇总了PHP中getContents函数的典型用法代码示例。如果您正苦于以下问题:PHP getContents函数的具体用法?PHP getContents怎么用?PHP getContents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getContents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isExistsID
function isExistsID($id)
{
$id = urlencode($id);
$config = array('HEADER' => true, 'NOBODY' => true);
$contents = getContents('http://manage.members.yahoo.com/index_deny.html?id=' . $id, $config);
if (!strstr($contents, 'error.html')) {
return true;
}
return false;
}
示例2: getSongInfo
function getSongInfo($id, $name)
{
global $hashKey, $serverUrl;
$sig = md5($hashKey . $id);
$url = $serverUrl . "songstreaming?id=" . $id . "&output=xml&sig=" . $sig;
$str = getContents($url);
$doc = new DOMDocument();
@$doc->loadXML($str);
$v = $doc->getElementsByTagName($name);
if ($v->length == 0) {
return;
}
return $v->item(0)->nodeValue;
}
示例3: loadAPI
public function loadAPI()
{
$result = $this->api->xpath("/eveapi/result/rowset[@name='assets']/row");
$this->assets = array();
foreach ($result as $entry) {
$contents = getContents($entry);
uasort($contents, "sortfunc_contents");
$this->assets[(double) $entry["itemID"]] = $contents;
}
$itemTypes = array();
$itemGroups = array();
$allLocs = array();
foreach ($this->assets as $item) {
$itemTypes = add_items($itemTypes, $item);
$allLocs[locationTranslate($item["locationID"])] = 1;
}
$this->Db->cacheItemTypes(array_keys($itemTypes));
$this->Db->cacheLocationIds(array_keys($allLocs));
foreach ($this->assets as $item) {
$itemGroups = add_groups($this->Db, $itemGroups, $item);
}
$this->Db->cacheGroupTypes(array_keys($itemGroups));
global $sortDb;
$sortDb = $this->Db;
uasort($this->assets, "sortfunc_locname");
$this->assetsByLocation = array();
foreach ($this->assets as $itemId => $item) {
$locid = locationTranslate($item["locationID"]);
if (!isset($this->assetsByLocation[$locid])) {
$this->assetsByLocation[locationTranslate($locid)] = array($item['itemID'] => $item);
} else {
$this->assetsByLocation[locationTranslate($locid)][$item['itemID']] = $item;
}
}
$this->totalCt = count($this->api->xpath("//row"));
//print_r($this->assets);
return true;
}
示例4: header
header("Content-Type: text/plain");
set_time_limit(0);
$url = "https://kmgy.localwiki.org/api/v4/maps/?format=json&points__within=%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B139.44677%2C36.083669%5D%2C%5B139.300618%2C36.111246%5D%2C%5B139.314815%2C36.146557%5D%2C%5B139.289754%2C36.160663%5D%2C%5B139.333038%2C36.179971%5D%2C%5B139.347251%2C36.253626%5D%2C%5B139.444139%2C36.196797%5D%2C%5B139.41663%2C36.188097%5D%2C%5B139.44677%2C36.083669%5D%5D%5D%7D";
$main_ary = array();
//タグとiconの読み替え
$icons = array("portal" => "/images/portal.png", "coolshare" => "/images/cool.png", "直実武蔵武士史跡" => "/images/naozane.gif");
$iconkeys = array_keys($icons);
getUrlToArray($url);
//必要なものに限定
$result_ary = array();
foreach ($main_ary as $data) {
$location = $data["points"]["coordinates"][0];
$data["location"] = $location;
$page = $data["page"];
$data["contents"] = getContents($page);
$tags = $data["contents"]["tags"];
$data["contents"]["icon"] = tags2icon($tags);
unset($data["url"]);
unset($data["region"]);
unset($data["geom"]);
unset($data["lines"]);
unset($data["polys"]);
unset($data["length"]);
unset($data["points"]);
$result_ary[] = $data;
}
$fp = fopen("/var/www/vhosts/kumagaya.code4saitama.org/httpdocs/js/kumagaya.json", "w");
fwrite($fp, json_encode($result_ary));
fclose($fp);
echo "end";
示例5: getContents
<table width="100%" cellspacing="0" cellpadding="0" style="border:solid 1px #dfdfdf;padding:10px 10px 10px 10px;">
<tr>
<td bgcolor="#efefef" style="padding:10px 10px 10px 10px;border-bottom:1px solid #dfdfdf;"><strong>공지 및 유의사항</strong></td>
</tr>
<tr>
<td valign="top" style="padding:10px 10px 10px 10px;border-bottom:1px solid #dfdfdf;line-height:17px;"><?php
echo $R['add_txt12'];
?>
</td>
</tr>
</table>
</div>
<div class="detail_contents">
<?php
echo getContents($R['content'], $R['html'], $keyword);
?>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right"><a href="#" onClick="history.go(0)"><img src="<?php
echo $g['img_module_skin'];
?>
/topicon.jpg" border="0"></a> </td>
</tr>
</table>
</div>
示例6: DOMDocument
$dom = new DOMDocument();
@$dom->loadHTML($html);
// grab all the on the page
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate('/html/body//div[@id="ImgCont"]//td//a');
for ($i = 0; $i < $hrefs->length; $i++) {
$url = $hrefs->item($i)->getAttribute('href');
list(, $querystring) = explode('?', $url);
$neturl = new Net_URL2("http://example.com/?{$querystring}");
$vars = $neturl->getQueryVariables();
if (isset($vars['imgurl'])) {
$images[] = $vars['imgurl'];
}
}
}
foreach ($images as $count => $image) {
preg_match_all('/([.][^.]+)$/', $image, $foo);
if (!isset($foo[0][0])) {
continue;
}
$ext = strtolower($foo[0][0]);
$filename = "images/kittens/{$count}{$ext}";
echo $filename . "\n";
try {
$contents = getContents($image, 0, $userAgent)->getBody();
} catch (HTTP_Request2_Exception $e) {
echo $e->getMessage() . "\n";
continue;
}
file_put_contents($filename, $contents);
}
示例7: getContents
<div id="content">
<div class="pqMain">
<?php
include_once 'panelmenu.php';
?>
<div class="cntHolder">
<?php
////////////////////////////////////////////////////////////////
/********************* Get Page ******************************/
if ($_GET['action'] == 'getpage' && !empty($_GET['page'])) {
@(include_once $_GET['page'] . '.php');
} else {
echo getContents($db, 'my_panel');
}
?>
</div>
</div>
</div> <!-- content End -->
<!-- Footer Include -->
<div id="footer"><?php
include_once 'footer.php';
?>
</div> <!-- wrraper End -->
示例8: getNumLoggedIn
/**
* getNumLoggedIn
*
* @access private
* @return number of logged in users with shells
*/
private function getNumLoggedIn()
{
// Snag command line of every process in system
$procs = glob('/proc/*/cmdline', GLOB_NOSORT);
// Store unqiue users here
$users = array();
// Each process
foreach ($procs as $proc) {
// Does the process match a popular shell, such as bash, csh, etc?
if (preg_match('/(?:bash|csh|zsh|ksh)$/', getContents($proc, ''))) {
// Who the fuck owns it, anyway?
$owner = fileowner(dirname($proc));
// Careful..
if (!is_numeric($owner)) {
continue;
}
// Have we not seen this user before?
if (!in_array($owner, $users)) {
$users[] = $owner;
}
}
}
// Give number of unique users with shells running
return count($users);
}
示例9: confirm
?>
" target="_action_frame_<?php
echo $m;
?>
" onclick="return confirm('정말로 신고하시겠습니까? ');">신고</a></span>
</div>
<div class="comment_reply">
<?php
if ($O['hidden'] && $my['nic'] == $O['nic']) {
?>
<span class="st_secret">비밀답글입니다.</span><br /><?php
}
?>
<?php
if (!$O['hidden'] or $my['admin'] or $my['nic'] == $R['nic']) {
echo getContents($O['content'], $O['html']);
if (getNew($O['d_regis'], 24)) {
?>
<span class="new"><img src="<?php
echo $g['img_module_skin'];
?>
/new.gif"></span><?php
}
} else {
?>
<span class="st_secret">비공개 답글입니다. ^^*</span><br /><?php
}
?>
</div>
</div>
<div class="clear"></div>
示例10: getEnterPerm
<?php
$ViewPerm = getEnterPerm($bbs[ViewPm], "", true, true);
if (!$ViewPerm) {
putErrPage(getErrorMsg(2));
}
$RCD = db_fetch_array(db_query("SELECT * FROM kimsbod7_{$table}_dat WHERE BB_UID='{$uid}'", $DB_CONNECT));
if (!$RCD[BB_UID]) {
putErrPage(getErrorMsg(3));
}
if ($RCD[BB_SECRET]) {
isSecretPass($HTTP_SESSION_VARS[kimsboard7_secr], $RCD[BB_UID], $RCD[BB_MB_ID]);
}
$g_Mail_Content = @implode('', @file('./bbs/lib/module/mailform/sendmail.txt'));
$g_Mail_Content = str_replace('[본문]', getContents($RCD[BB_CONTENT], $RCD[BB_HTML], $bbs[TextHLight]), $g_Mail_Content);
$g_Mail_Content = str_replace('[멘트]', nl2br(htmlspecialchars($content)), $g_Mail_Content);
$g_Mail_Content = str_replace('[경로]', $root[base], $g_Mail_Content);
$g_Mail_Content = str_replace('[제목]', $subject, $g_Mail_Content);
$g_Mail_Content = str_replace('[출처]', $root[title], $g_Mail_Content);
$g_Mail_Content = str_replace('[원문]', $root[base] . '/bbs.php?table=' . $table . '&query=view&uid=' . $uid, $g_Mail_Content);
$g_Mail_Content = str_replace('[원제]', $RCD[BB_SUBJECT], $g_Mail_Content);
$To = "\"{$to_name}\" <{$to_email}>";
$Frm = "\"{$from_name}\" <{$from_email}>";
$Header = "From:{$Frm}\nContent-Type:text/html\nReply-To:{$frm}\nX-Mailer:PHP/" . phpversion();
$result = @mail($To, $subject, stripslashes($g_Mail_Content), $Header);
$alert = $result ? "It was sent out in the normality." : "This mail is not sent out.";
?>
<meta http-equiv="content-type" content="text/html; charset=euc-kr">
示例11: getCommentList
function getCommentList($theme, $parent, $_where, $recnum, $sort, $orderby1, $orderby2, $cp)
{
global $g, $table, $_HS, $m, $my;
include $theme . '_var.php';
// 설정파일 인클루드
$g['img_module_skin'] = $theme . 'image/';
$NCD = array();
$RCD = array();
$cp = $cp ? $cp : 1;
$sort = $sort ? $sort : 'uid';
$orderby1 = $orderby1 ? $orderby1 : $d['comment']['orderby1'];
$orderby2 = $orderby2 ? $orderby2 : $d['comment']['orderby2'];
$recnum = $recnum ? $recnum : $d['comment']['recnum'];
$cmentque = " and parent='" . str_replace('-', '', $parent) . "'";
if ($_where) {
$cmentque .= " and " . $_where;
}
$PCD = getDbArray($table['s_comment'], 'notice=1' . $cmentque, '*', $sort, $orderby1, 0, 0);
$TCD = getDbArray($table['s_comment'], 'notice=0' . $cmentque, '*', $sort, $orderby2, $recnum, $cp);
$NUM = getDbRows($table['s_comment'], 'notice=0' . $cmentque);
$TPG = getTotalPage($NUM, $recnum);
while ($_R = db_fetch_array($PCD)) {
$NCD[] = $_R;
}
while ($_R = db_fetch_array($TCD)) {
$RCD[] = $_R;
}
//echo $cmentque;
$RCD = $NCD + $RCD;
$i = 1;
$namegi = $NUM - $cp * $recnum;
if ($namegi > 0) {
$namegi_ment = '총 <span class="text-danger namegi">' . $namegi . '</span> 개의 댓글이 더 있습니다.';
$btn_more = 'btn-more';
$is_namegi = 1;
} else {
$namegi_ment = '더이상 댓글이 없습니다.';
$btn_more = 'disabled';
$is_namegi = 0;
}
// 한줄의견 쓰는(현재 로그인한) 사용자 아바타 사진 url 세팅
if ($my['photo']) {
$avatar_img = $g['url_root'] . '/_var/avatar/' . $my['photo'];
} else {
$avatar_img = $g['url_root'] . '/_var/avatar/0.gif';
}
foreach ($RCD as $C) {
$C['mobile'] = isMobileConnect($C['agent']);
if ($C['mbruid']) {
$M = getDbData($table['s_mbrdata'], 'memberuid=' . $C['mbruid'], '*');
} else {
$M = array();
}
$isSECRETCHECK = true;
$JN_time = getJNTime($C['d_regis']);
// 지난시간 얻기 함수 호출
// 댓글 작성자 아바타 사진 url 세팅
if ($M['photo']) {
$avatar_img = $g['url_root'] . '/_var/avatar/' . $M['photo'];
} else {
$avatar_img = $g['url_root'] . '/_var/avatar/0.gif';
}
echo '
<section id="pinBoot" class="rb-pinterest-grid">
<article class="panel panel-default panel-google-plus comment-list" id="' . $C['uid'] . '-' . $C['score1'] . '-' . $C['oneline'] . '">
<div id="cuid-' . $C['uid'] . '">
<input type="hidden" name="is_namegi" value="' . $is_namegi . '"/>
<input type="hidden" name="TPG" value="' . $TPG . '"/>
<input type="hidden" name="theme" class="theme" value="' . $theme . '" />
<input type="hidden" name="parent" class="parent" value="' . $parent . '" />
<input type="hidden" name="c_content" class="c_content" value="' . htmlspecialchars(getContents($C['content'], $C['html'], $keyword)) . '" />
<div class="dropdown">
<span class="dropdown-toggle" type="button" data-toggle="dropdown">
<span class="[ glyphicon glyphicon-chevron-down ]"></span>
</span>
<ul class="dropdown-menu" role="menu">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
</ul>
</div>
<div class="panel-google-plus-tags">
<ul>
<li>#자동차</li>
<li>#귀성길</li>
</ul>
</div>
<div class="panel-heading">
<img class="img-circle pull-left" src="/_core/opensrc/thumb/image.php?width=46&height:46&cropratio=1:1&image=' . $avatar_img . '" alt="' . $M[$_HS['nametype']] . ' 아바타 " />
<h3>소비자와 함께</h3>
<h5><span>제한적으로 공유함</span> - <span>' . getDateFormat($C['d_regis'], 'Y. m. d') . '</span> </h5>
</div>
<div class="panel-body">
<p>' . getContents($C['content'], $C['html'], $keyword) . '</p>
</div>
<div class="panel-footer">
<button type="button" class="btn btn-default">+1</button>
<button type="button" class="btn btn-default">
//.........这里部分代码省略.........
示例12: getServices
/**
* getServices
*
* @access private
* @return array the services
*/
public function getServices()
{
// Time?
if (!empty($this->settings['timer'])) {
$t = new LinfoTimerStart('Services');
}
// We allowed?
if (!empty($settings['show']['services']) || !is_array($this->settings['services']) || count($this->settings['services']) == 0) {
return array();
}
// Temporarily keep statuses here
$statuses = array();
// A bit of unfucking potential missing values in config file
$this->settings['services']['executables'] = (array) $this->settings['services']['executables'];
$this->settings['services']['pidFiles'] = (array) $this->settings['services']['pidFiles'];
// Convert paths of executables to PID files
$pids = array();
$do_process_search = false;
if (count($this->settings['services']['executables']) > 0) {
$potential_paths = @glob('/proc/*/cmdline');
if (is_array($potential_paths)) {
$num_paths = count($potential_paths);
$do_process_search = true;
}
}
// Should we go ahead and do the PID search based on executables?
if ($do_process_search) {
// Precache all process cmdlines
for ($i = 0; $i < $num_paths; $i++) {
$cmdline_cache[$i] = explode("", getContents($potential_paths[$i]));
}
// Go through the list of executables to search for
foreach ($this->settings['services']['executables'] as $service => $exec) {
// Go through pid file list. for loops are faster than foreach
for ($i = 0; $i < $num_paths; $i++) {
$cmdline = $cmdline_cache[$i];
$match = false;
if (is_array($exec)) {
$match = true;
foreach ($exec as $argn => $argv) {
if ($cmdline[$argn] != $argv) {
$match = false;
}
}
} else {
if ($cmdline[0] == $exec) {
$match = true;
}
}
// If this one matches, stop here and save it
if ($match) {
// Get pid out of path to cmdline file
$pids[$service] = substr($potential_paths[$i], 6, strpos($potential_paths[$i], '/', 7) - 6);
break;
}
}
}
}
// PID files
foreach ($this->settings['services']['pidFiles'] as $service => $file) {
$pid = getContents($file, false);
if ($pid != false && is_numeric($pid)) {
$pids[$service] = $pid;
}
}
// Deal with PIDs
foreach ($pids as $service => $pid) {
$path = '/proc/' . $pid . '/status';
$status_contents = getContents($path, false);
if ($status_contents == false) {
$statuses[$service] = array('state' => 'Down', 'threads' => 'N/A', 'pid' => $pid);
continue;
}
// Attempt getting info out of it
if (!preg_match_all('/^(\\w+):\\s+(\\w+)/m', $status_contents, $status_matches, PREG_SET_ORDER)) {
continue;
}
// Initially set these as pointless
$state = false;
$threads = false;
$mem = false;
// Go through
//foreach ($status_matches as $status_match) {
for ($i = 0, $num = count($status_matches); $i < $num; $i++) {
// What have we here?
switch ($status_matches[$i][1]) {
// State section
case 'State':
switch ($status_matches[$i][2]) {
case 'D':
// disk sleep? wtf?
// disk sleep? wtf?
case 'S':
$state = 'Up (Sleeping)';
//.........这里部分代码省略.........
示例13: explode
echo $adddata['honeymoon'];
?>
</dd>
</dl>
<div class="clear"></div>
<?php
// 내용 쪼개기
$arrContent = explode("[bc_separator]", $R['content']);
if ($_GET['dp'] == "resort" || $_GET['dp'] == "") {
echo getContents($arrContent[0], $R['html']) . "\n<br><br>\n";
}
if ($_GET['dp'] == "room" || $_GET['dp'] == "") {
echo getContents($arrContent[1], $R['html']) . "\n<br><br>\n";
}
if ($_GET['dp'] == "facility" || $_GET['dp'] == "") {
echo getContents($arrContent[2], $R['html']) . "\n<br><br>\n";
}
?>
<?php
if ($_GET['dp'] == "sdetail") {
?>
<table class="miniboard">
<colgroup>
<col width="100" />
<col width="70" />
<col width="80" />
<col width="" />
<col width="120" />
</colgroup>
<thead>
示例14: getNews
function getNews()
{
$url = "http://rss.sina.com.cn/news/marquee/ddt.xml";
$content = getContents($url);
// $rss =& new XML_RSS($content);
// $rss->parse();
// $news_str = "";
// foreach ($rss->getItems() as $item)
// {
// $news_str .= $item['title']." ";
// }
return $content;
}
示例15: sprintf
exit;
}
@ini_set('magic_quotes_runtime', 0);
// 2) PIWIK.PHP PROXY: GET parameters found, this is a tracking request, we redirect it to Piwik
$url = sprintf("%spiwik.php?cip=%s&token_auth=%s&", $PIWIK_URL, getVisitIp(), $TOKEN_AUTH);
foreach ($_GET as $key => $value) {
$url .= urlencode($key) . '=' . urlencode($value) . '&';
}
sendHeader("Content-Type: image/gif");
$stream_options = array('http' => array('user_agent' => arrayValue($_SERVER, 'HTTP_USER_AGENT', ''), 'header' => sprintf("Accept-Language: %s\r\n", str_replace(array("\n", "\t", "\r"), "", arrayValue($_SERVER, 'HTTP_ACCEPT_LANGUAGE', ''))), 'timeout' => $timeout));
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
// PHP 5.2 breaks with the new 204 status code so we force returning the image every time
echo getContents($url . '&send_image=1', $stream_options);
} else {
// PHP 5.3 and above
$content = getContents($url, $stream_options);
// Forward the HTTP response code
if (!headers_sent() && isset($http_response_header[0])) {
header($http_response_header[0]);
}
echo $content;
}
function getVisitIp()
{
$matchIp = '/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/';
$ipKeys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_CF_CONNECTING_IP');
foreach ($ipKeys as $ipKey) {
if (isset($_SERVER[$ipKey]) && preg_match($matchIp, $_SERVER[$ipKey])) {
return $_SERVER[$ipKey];
}
}