本文整理汇总了PHP中getHost函数的典型用法代码示例。如果您正苦于以下问题:PHP getHost函数的具体用法?PHP getHost怎么用?PHP getHost使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getHost函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHtmlContext
function getHtmlContext($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
//表示需要response header
curl_setopt($ch, CURLOPT_NOBODY, FALSE);
//表示需要response body
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
$result = curl_exec($ch);
global $header;
if ($result) {
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = explode("\r\n", substr($result, 0, $headerSize));
$body = substr($result, $headerSize);
}
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '200') {
return $body;
}
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == '302') {
$location = getHeader("Location");
if (strpos(getHeader("Location"), 'http://') == false) {
$location = getHost($url) . $location;
}
return getHtmlContext($location);
}
return NULL;
}
示例2: getOpenID
/**
* 授权
*/
public function getOpenID()
{
$weObj = new \System\lib\Wechat\Wechat($this->config("WEIXIN_CONFIG"));
$this->weObj = $weObj;
if (empty($_GET['code']) && empty($_GET['state'])) {
$callback = getHostUrl();
$reurl = $weObj->getOauthRedirect($callback, "1");
redirect($reurl, 0, '正在发送验证中...');
exit;
} elseif (intval($_GET['state']) == 1) {
$accessToken = $weObj->getOauthAccessToken();
// 是否有用户记录
$isUser = $this->table('user')->where(["openid" => $accessToken['openid'], 'is_on' => 1])->get(null, true);
/*var_dump($isUser);exit();*/
if ($isUser == null) {
//没有此用户跳转至输入注册的页面
header("LOCATION:" . getHost() . "/register.html");
} else {
$userID = $isUser['id'];
$updateUser = $this->table('user')->where(['id' => $userID])->update(['last_login' => time(), 'last_ip' => ip2long(getClientIp())]);
$_SESSION['userInfo'] = ['openid' => $isUser['openid'], 'userid' => $isUser['id'], 'nickname' => $isUser['nickname'], 'user_img' => $isUser['user_img']];
//var_dump($_SESSION['userInfo']['openid']);exit();
header("LOCATION:http://onebuy.ping-qu.com");
//进入网站成功
//用户取消授权
//
//$this->R('','90006');
}
}
}
示例3: setUp
function setUp()
{
/*
* This test requires that the fossology test archive has been
* loaded under the name fossarchive-T.tar.bz2 For now, the setup
* will just verify the material is there?
*/
global $URL;
global $name;
global $safeName;
$name = 'fossI16L518.tar.bz2';
$safeName = escapeDots($name);
$this->host = getHost($URL);
$this->Login();
/* check for existense of archive */
$page = $this->mybrowser->get($URL);
$page = $this->mybrowser->clickLink('Browse');
$this->assertTrue($this->myassertText($page, '/Browse/'), "verifyFossI16L518 FAILED! Could not find Browse menu\n");
$page = $this->mybrowser->clickLink('Testing');
$this->assertTrue($this->myassertText($page, '/Testing/'), "verifyFossI16L518 FAILED! Could not find Testing folder\n");
$result = $this->myassertText($page, "/{$safeName}/");
if (!$result) {
exit(FALSE);
}
}
示例4: getUrlfromDir
function getUrlfromDir($local_dir)
{
//-------------------------------
$server_dir = getWebDir($local_dir);
$server_scheme = getScheme();
$server_host = getHost();
return "{$server_scheme}://{$server_host}/{$server_dir}";
}
示例5: agregateLogs
public function agregateLogs($error, $data = null)
{
App::getServiceLog()->log($error, $data);
$subject = 'Message subject ąśżźćę';
$body = App::template('stopsupervisor', array('error' => $error, 'data' => $data, 'host' => getHost()));
$message = Swift_Message::newInstance()->setSubject('webservice [' . getHost() . '] - error')->setFrom('noreplay@pcube.com', 'webservice')->setTo(App::getConfig('swiftmailer.cron_log_errors'))->setBody($body, 'text/html')->addPart(strip_tags($body), 'text/plain');
App::getServiceMailer()->send($message);
}
示例6: get_source_domain
function get_source_domain($dname)
{
$dname = getHost($dname);
$dsub = substr($dname, 0, 4);
if (strtolower($dsub) == "www.") {
$dname = substr($dname, 4);
}
return $dname;
}
示例7: __construct
function __construct($page, $url)
{
/* to do: check for http? if not return null...)? */
if (empty($page)) {
return;
}
$this->page = $page;
if (empty($url)) {
return;
}
$this->host = getHost($url);
}
示例8: raport
public function raport()
{
$key = 'crontime';
$limit = 8;
$cache = App::getCache();
$worker = App::getServiceWorker();
$ltime = $cache->get($key);
// poprzednie badanie
// niechginie($ltime);
$ntime = date('Y-m-d H:i:s');
// teraz
$ltime or $ltime = $ntime;
$cache->set($key, $ntime);
// nieginie($ltime);
// nieginie($worker->countErrorFromSince($ltime));
// niechginie($worker->getLastErrors($ltime));
if ($num = $worker->countErrorFromSince($ltime)) {
$body = App::template('cronraport', array('list' => $worker->getLastErrors($ltime, $limit), 'limit' => $limit, 'ltime' => $ltime, 'num' => $num, 'host' => getHost(), 'panel' => App::generate('admin', array(), $referenceType = true)));
$message = Swift_Message::newInstance()->setSubject('webservice [' . getHost() . '] - error')->setFrom('noreplay@pcube.com', 'webservice')->setTo($this->emails)->setBody($body, 'text/html')->addPart(strip_tags($body), 'text/plain');
App::getServiceMailer()->send($message);
}
}
示例9: setUp
function setUp()
{
/*
* This test requires that the fossology test archive has been
* loaded under the name 3files.tar.bz2
*/
global $URL;
global $name;
global $safeName;
$name = 'RedHat.tar.gz';
$safeName = escapeDots($name);
$this->host = getHost($URL);
//print "SetUp: host is:$this->host\n";
$this->Login();
/* check for existense of archive */
$page = $this->mybrowser->get($URL);
$page = $this->mybrowser->clickLink('Browse');
$this->assertTrue($this->myassertText($page, '/Browse/'), "verifySimpletest FAILED! Could not find Browse menu\n");
$page = $this->mybrowser->clickLink('Testing');
$this->assertTrue($this->myassertText($page, "/{$safeName}/"), "verifySimpleTest FAILED! Could not find RedHat.tar upload\n");
$result = $this->myassertText($page, "/{$name}/");
//if(!($result)) { echo "WTF!\n"; exit(FALSE); }
}
示例10: setUp
function setUp()
{
/*
* This test requires that the fossology test archive has been
* loaded under the name 3files.tar.bz2
*/
global $URL;
global $name;
global $safeName;
$name = '3files.tar.bz2';
$safeName = escapeDots($name);
$this->host = getHost($URL);
$this->Login();
/* check for existense of archive */
$page = $this->mybrowser->get($URL);
$page = $this->mybrowser->clickLink('Browse');
$this->assertTrue($this->myassertText($page, '/Browse/'), "verify3files FAILED! Could not find Browse menu\n");
$page = $this->mybrowser->clickLink('Copyright');
$this->assertTrue($this->myassertText($page, '/Copyright/'), "verify3files FAILED! Could not find copyright folder\n");
$result = $this->myassertText($page, "/{$name}/");
if (!$result) {
exit(FALSE);
}
}
示例11: setUp
function setUp()
{
/*
* This test requires that the fossology test archive has been
* loaded under the name fossDirsOnly.tar.bz2
*/
global $URL;
global $name;
global $safeName;
print "starting verifyFossDirsOnly-SetUp\n";
$name = 'fossDirsOnly.tar.bz2';
$safeName = escapeDots($name);
$this->host = getHost($URL);
$this->Login();
/* check for existense of archive */
$page = $this->mybrowser->get($URL);
$page = $this->mybrowser->clickLink('Browse');
$this->assertTrue($this->myassertText($page, '/Browse/'), "verifyDirsOnly FAILED! Could not find Browse menu\n");
$result = $this->myassertText($page, "/{$safeName}/");
if (!$result) {
$this->fail("Failure, cannot find archive {$name}, Stopping test\n");
exit(1);
}
}
示例12: dirname
<?php
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
$queryList = getSQLQuery(getPDO());
$menuList = getMenuListForProcOrder(getPDO(), $queryList["SELECT_MENU_FOR_PROCORDER"]);
$menuData = getProced(getPDO(), $menuList);
$threadList = getThreadListUrl($menuData["menu_url"], getDiFix(getPDO(), "threadListUrlSuffix", $menuData["kind"], $queryList["SELECT_DIFIX"]));
var_dump($menuData);
var_dump(getUa(getPDO(), $queryList["SELECT_UA"]));
var_dump(getHost($menuData["menu_url"]));
$html = threadSteal(getPDO(), "133.130.96.221", "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
var_dump($html);
示例13: getPageUrl
/**
* Get the url of corresponding page. for gene network diagram.
* @param type $pageName
* @param type $idArr
* @return string
*/
function getPageUrl($pageName, $idArr = array(1, 2, 3, 4))
{
$host = getHost();
$param = idArr2Str($idArr);
switch ($pageName) {
case "entirePathway":
$preUrl = "/mccap-server/app/page/mapEntirePathway.php?id=";
break;
case "metaPathway":
$preUrl = "/mccap-server/app/page/mapMetaPathway.php?id=";
break;
case "entireModule":
$preUrl = "/mccap-server/app/page/mapEntireModule.php?id=";
break;
case "metaModule":
$preUrl = "/mccap-server/app/page/mapMetaModule.php?id=";
break;
default:
$preUrl = "/mccap-server/app/page/error.php";
$param = "";
break;
}
$url = $host . $preUrl . $param;
return $url;
}
示例14: _getFollowReply
/**
* 获取关注回复
*/
private function _getFollowReply()
{
if (!empty($this->userInfo)) {
//活动回复
if (!empty($user['parent'] && !empty($user['parent_share_type']) && !empty($user['activity_id']))) {
//是否在进行活动
$isActivity = $this->table('activity_share_' . $user['parent_share_type'])->where(['is_on' => 1, 'is_show' => 1])->get(['id', 'start_time', 'end_time'], true);
if ($isActivity) {
if (time() > $isActivity['start_time'] && time() < $isActivity['end_time']) {
switch ($user['parent_share_type']) {
case 1:
$content = '欢迎关注广融在线!你已获得参与广融活动“邀好友送特权利率”活动的资格。马上<a href="' . getHost() . '/activity/activity_1_1.html?activity_id=' . $user['activity_id'] . '">点击这里</a>进行领取!';
break;
case 2:
//$content='欢迎关注广融在线!你可参加“投资送现金活动”。马上<a href="'.getHost().'/activity/activity_2_1.html?activity_id='.$user['activity_id'].'">点击这里</a>了解活动详情!';
$content = '对!骚年你没关注错 !' . "\r\n";
$content .= '这是稳拿8%~13%收益的赚钱平台!' . "\r\n";
$content .= '投资随投随取,快捷方便!' . "\r\n";
$content .= '收益完胜各大银行和各类宝宝!' . "\r\n";
$content .= '快来参与日赚百元计划“领100元红包”吧!' . "\r\n";
$content .= '红包有限!先到先得哦~' . "\r\n";
$content .= '<a href="' . getHost() . '/activity/activity_2_1.html?activity_id=' . $user['activity_id'] . '">点击领100元红包</a>';
break;
}
}
}
}
}
$followReply = $this->table("wechat_response")->where(array("type" => 2, 'is_on' => 1))->get(null, true);
if (!$followReply) {
return false;
}
if ($followReply['rsp_type'] == 0) {
//文本回复
$this->weObj->text($followReply['text'])->reply();
exit;
}
if ($followReply['rsp_type'] == 1) {
//图文回复(未实现)
// $news_temp = $this->table("wechat_news")->where(array("id" => $followReply['news'], 'is_on' => 1))->order('sort_order asc')->get(null, true);
$news_temp = $this->table("wechat_news")->where(array("id" => $followReply['news'], 'is_on' => 1))->get();
//get()内不能
// $this->weObj->text("text")->reply();exit;
foreach ($news_temp as $a) {
$news[] = array('Title' => $a['title'], 'Description' => $a['desc'], 'PicUrl' => $a['img_thumb_360'], 'Url' => empty($a['url']) ? empty($a['url']) ? $this->config('WEIXIN_ARTICLE_PATH') . $a['id'] : $a['url'] : $a['url']);
}
$this->weObj->news($news)->reply();
exit;
}
}
示例15: getHostname
public function getHostname()
{
return getHost();
}