当前位置: 首页>>代码示例>>PHP>>正文


PHP getHostByName函数代码示例

本文整理汇总了PHP中getHostByName函数的典型用法代码示例。如果您正苦于以下问题:PHP getHostByName函数的具体用法?PHP getHostByName怎么用?PHP getHostByName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getHostByName函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testItCanGetJobProgressionFromApiInRealLife

 public function testItCanGetJobProgressionFromApiInRealLife()
 {
     // Check for and set required server variables
     if (!isset($_SERVER['PARTNER_ID'])) {
         $this->markTestSkipped('PARTNER_ID is not available');
     }
     if (!isset($_SERVER['PARTNER_KEY'])) {
         $this->markTestSkipped('PARTNER_KEY is not available');
     }
     $_SERVER['REMOTE_ADDR'] = getHostByName(getHostName());
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36';
     // Instantiate the connection
     $config = new Config($_SERVER['PARTNER_ID'], $_SERVER['PARTNER_KEY']);
     $connection = new Connection($config);
     $action = new JobProgression();
     $action->addparam('jobTitle', 'developer');
     // Get the response from the API
     $response = $connection->call($action);
     // Assert proper classes/results are returned
     $this->assertEquals('Glassdoor\\ResponseObject\\JobProgressionResponse', get_class($response));
     foreach ($response->getJobProgressions() as $progression) {
         $this->assertEquals('Glassdoor\\ResponseObject\\JobProgression', get_class($progression));
         $this->assertNotNull($progression->getJobTitle());
     }
 }
开发者ID:karllhughes,项目名称:glassdoor,代码行数:25,代码来源:JobProgressionAcceptanceTest.php

示例2: __construct

 public function __construct()
 {
     //
     $this->id = 'komercigateway';
     $this->icon = plugins_url('images/komerci.png', __FILE__);
     $this->has_fields = true;
     $this->method_title = 'Komerci Settings';
     //
     $this->init_form_fields();
     $this->init_settings();
     //
     $this->title = $this->get_option('title');
     $this->description = $this->get_option('description');
     $this->filiacao = $this->get_option('filiacao');
     $this->token = $this->get_option('token');
     $this->method = $this->get_option('method');
     //
     $this->user = $this->get_option('user');
     $this->password = $this->get_option('password');
     //
     $this->test = $this->get_option('test');
     $this->supports = array('default_credit_card_form');
     $this->komerci_cardtypes = $this->get_option('komerci_cardtypes');
     //
     $this->siteurl = $_SERVER['SERVER_NAME'];
     $this->serverip = getHostByName(php_uname('n'));
     //
     $this->komerci_wsdlurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?WSDL';
     $this->komerci_liveurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx';
     $this->komerci_testurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap_teste.asmx';
     $this->komerci_methodurl = 'https://ecommerce.redecard.com.br/pos_virtual/wskomerci/cap.asmx?op=GetAuthorized';
     if (is_admin()) {
         add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     }
 }
开发者ID:eltondev,项目名称:komerci,代码行数:35,代码来源:woocommerce-komerci.php

示例3: process_report_command

function process_report_command($command)
{
    $public_ip = getHostByName(php_uname('n'));
    $pid = (string) getmypid();
    print sprintf("REPORT: public_ip: %s, pid: %s\n\r", $public_ip, $pid);
    $command->process(compact('public_ip', 'pid'));
}
开发者ID:attm2x,项目名称:m2x-php-mqtt,代码行数:7,代码来源:process_commands.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $thisIP = getHostByName(getHostName());
     $testuser = User::create(array('username' => 'admin', 'email' => 'admin@admin.com', 'password' => Hash::make('admin'), 'created_ip' => $thisIP, 'last_ip' => $thisIP, 'created_by_user_id' => 1));
     DB::table('user_permissions')->delete();
     UserPermission::create(array('user_id' => $testuser->id, 'solder_full' => true));
 }
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:13,代码来源:UserTableSeeder.php

示例5: userLastVisit

 protected function userLastVisit($user_id)
 {
     $model = User::findOrFail($user_id);
     date_default_timezone_set("Asia/Dacca");
     $date = date('Y-m-d H:i:s', time());
     $model->last_visit = $date;
     $model->ip_address = getHostByName(getHostName());
     $model->save();
 }
开发者ID:selimppc,项目名称:ecies,代码行数:9,代码来源:AdminController.php

示例6: getLocalIp

 public function getLocalIp()
 {
     $CI = & get_instance();
     $ip = $CI->input->ip_address();
     if ($ip == '::1') {
         $ip = getHostByName(getHostName());
     }
     return $ip;
 }
开发者ID:nhatlang19,项目名称:elearningONL,代码行数:9,代码来源:Utils.php

示例7: ServerDetails

function ServerDetails()
{
    echo "<div id=\"ServerDetails\">a\n\t\t\t<h3>Server Details</h3><br>";
    echo 'Current PHP version: ' . phpversion() . "<br>";
    echo 'Current Operating System:' . php_uname();
    echo '<br>IP Address of Server: ' . getHostByName($_SERVER['HTTP_HOST']) . "<br>";
    echo $_SERVER['SERVER_SOFTWARE'];
    echo "</div>";
}
开发者ID:ScottRMcleod,项目名称:PHP,代码行数:9,代码来源:GetingServerDetails.php

示例8: index

 function index()
 {
     $data['system'] = $_SERVER['HTTP_USER_AGENT'];
     //操作系统与浏览器信息
     $data['server'] = PHP_OS . '&nbsp;&nbsp; PHP v' . PHP_VERSION;
     //php版本等信息
     $data['web'] = $_SERVER['SERVER_SOFTWARE'] . '&nbsp;&nbsp;' . getenv("HTTP_ACCEPT_LANGUAGE");
     //WEB服务器版本
     $data['safe'] = @ini_get('safe_mode') ? 'ON' : 'OFF';
     //安全模式
     $data['mysql'] = mysql_get_server_info();
     //mysql版本
     $data['cfg_var'] = get_cfg_var("memory_limit") ? get_cfg_var("memory_limit") : "无";
     //可用最大内存
     $data['cfg_max_size'] = get_cfg_var("post_max_size");
     //POST提交限制
     $data['max_execution_time'] = get_cfg_var("max_execution_time");
     //脚本超出时间
     $data['max_file_size'] = get_cfg_var("upload_max_filesize") ? get_cfg_var("upload_max_filesize") : "不允许上传附件";
     //上传限制
     $data['allow_url_fopen'] = @ini_get('allow_url_fopen') ? "ON" : "OFF";
     //是否允许打开远程文件
     $data['disk_size'] = $this->noya->get_file_size(disk_free_space("."));
     //服务器剩余空间大小
     //计算数据库大小
     $content_datasize = $datasize = $indexsize = 0;
     $query = $this->db->query("SHOW TABLE STATUS");
     //$this->fire_php->fire_start($this->noya->get_last_query());
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $datasize += $row->Data_length;
             $indexsize += $row->Index_length;
             $content_datasize += $row->Data_length + $row->Index_length;
         }
     }
     $data['content_datasize'] = $this->noya->get_file_size($content_datasize);
     //GD库是否支持
     $data['GD'] = function_exists("imageline") == 1 ? $this->noya->temp(function_exists("imageline")) : $this->noya->temp(function_exists("imageline"));
     //SESSION是否支持
     $data['allow_session'] = $this->noya->temp(function_exists("session_start"));
     //网站域名
     $data['host_name'] = $_SERVER['SERVER_NAME'];
     //网站IP
     $data['host_address'] = getHostByName(php_uname('n')) . ':' . $_SERVER['SERVER_PORT'];
     //网站当前时间
     $data['host_data'] = date("Y-m-d  H:i");
     //当前访问者ip
     $data['memeber_ip'] = $_SERVER["SERVER_ADDR"];
     //被屏蔽函数
     $data['disable_funcs'] = get_cfg_var("disable_functions") ? get_cfg_var("disable_functions") : "无";
     $this->load->vars($data);
     $this->load->view('backend/main');
 }
开发者ID:miguelmeca,项目名称:wscat,代码行数:53,代码来源:main.php

示例9: hocwp_get_pc_ip

function hocwp_get_pc_ip()
{
    $result = '';
    if (function_exists('getHostByName')) {
        if (version_compare(PHP_VERSION, '5.3', '<') && function_exists('php_uname')) {
            $result = getHostByName(php_uname('n'));
        } elseif (function_exists('getHostName')) {
            $result = getHostByName(getHostName());
        }
    }
    return $result;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:12,代码来源:core-functions.php

示例10: DVRUI_HDHRjson

 public function DVRUI_HDHRjson()
 {
     $storageURL = "??";
     $myip = getHostByName(getHostName());
     $hdhr_data = getJsonFromUrl($this->myhdhrurl);
     for ($i = 0; $i < count($hdhr_data); $i++) {
         $hdhr = $hdhr_data[$i];
         $hdhr_base = $hdhr[$this->hdhrkey_baseURL];
         $hdhr_ip = $hdhr[$this->hdhrkey_localIP];
         if (!array_key_exists($this->hdhrkey_discoverURL, $hdhr)) {
             // Skip this HDHR - it doesn't support the newer HTTP interface
             // for DVR
             continue;
         }
         $hdhr_info = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]);
         if (array_key_exists($this->hdhrkey_storageURL, $hdhr)) {
             // this is a record engine!
             // Need to confirm it's a valid one - After restart of
             // engine it updates my.hdhomerun.com but sometimes the
             // old engine config is left behind.
             $rEngine = getJsonFromUrl($hdhr[$this->hdhrkey_discoverURL]);
             if (strcmp($rEngine[$this->hdhrkey_storageID], $hdhr[$this->hdhrkey_storageID]) != 0) {
                 //skip, this is not a valid engine
                 continue;
             }
             //get the IP address of record engine.
             $hdhr_ip = $hdhr[$this->hdhrkey_localIP];
             // Split IP and port
             if (preg_match('/^(\\d[\\d.]+):(\\d+)\\b/', $hdhr_ip, $matches)) {
                 $ip = $matches[1];
                 $port = $matches[2];
                 // if IP of record engine matches the IP of this server
                 // return storageURL
                 if ($ip == $myip) {
                     $this->storageURL = $hdhr[$this->hdhrkey_storageURL];
                     continue;
                 }
             }
         }
         // ELSE we have a tuner
         $tuners = 'unknown';
         if (array_key_exists($this->hdhrkey_tuners, $hdhr_info)) {
             $tuners = $hdhr_info[$this->hdhrkey_tuners];
         }
         $legacy = 'No';
         if (array_key_exists($this->hdhrkey_legacy, $hdhr_info)) {
             $legacy = $hdhr_info[$this->hdhrkey_legacy];
         }
         $hdhr_lineup = getJsonFromUrl($hdhr_info[$this->hdhrkey_lineupURL]);
         $this->hdhrlist[] = array($this->hdhrkey_devID => $hdhr[$this->hdhrkey_devID], $this->hdhrkey_modelNum => $hdhr_info[$this->hdhrkey_modelNum], $this->hdhrlist_key_channelcount => count($hdhr_lineup), $this->hdhrkey_baseURL => $hdhr_base, $this->hdhrkey_lineupURL => $hdhr_info[$this->hdhrkey_lineupURL], $this->hdhrkey_modelName => $hdhr_info[$this->hdhrkey_modelName], $this->hdhrkey_auth => $hdhr_info[$this->hdhrkey_auth], $this->hdhrkey_fwVer => $hdhr_info[$this->hdhrkey_fwVer], $this->hdhrkey_tuners => $tuners, $this->hdhrkey_legacy => $legacy, $this->hdhrkey_fwName => $hdhr_info[$this->hdhrkey_fwName]);
     }
 }
开发者ID:Silicondust,项目名称:dvr_install,代码行数:52,代码来源:dvrui_hdhrjson.php

示例11: testItCanGetJobsFromApi

 /**
  * Integration test with actual API call to the provider.
  */
 public function testItCanGetJobsFromApi()
 {
     if (!getenv('PARTNER_ID')) {
         $this->markTestSkipped('PARTNER_ID not set. Real API call will not be made.');
     }
     $keyword = 'engineering';
     $query = new JujuQuery(['k' => $keyword, 'partnerid' => getenv('PARTNER_ID'), 'ipaddress' => getHostByName(getHostName())]);
     $client = new JujuProvider($query);
     $results = $client->getJobs();
     $this->assertInstanceOf('JobApis\\Jobs\\Client\\Collection', $results);
     foreach ($results as $job) {
         $this->assertEquals($keyword, $job->query);
     }
 }
开发者ID:jobbrander,项目名称:jobs-juju,代码行数:17,代码来源:JujuProviderTest.php

示例12: connect

 public function connect()
 {
     $hostname = "localhost";
     $username = "root";
     $password = "123456";
     $_dbsname = "kepe3788_db";
     if (getHostByName(getHostName()) != '127.0.1.1') {
         $hostname = "103.247.8.138";
         $username = "kepe3788_user";
         $password = "1234_asdf";
         $_dbsname = "kepe3788_db";
     }
     $this->conn = new mysqli($hostname, $username, $password, $_dbsname);
     if ($this->conn->connect_error) {
         die("Connection failed: " . $this->conn->connect_error);
     }
     return $this->conn;
 }
开发者ID:kepoabiscom,项目名称:kepe-dev,代码行数:18,代码来源:db.php

示例13: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('users', function ($table) {
         $table->increments('id');
         $table->string('username');
         $table->string('email');
         $table->string('password');
         $table->string('created_ip');
         $table->string('last_ip')->nullable();
         $table->timestamps();
     });
     /**
      * Create Default User
      **/
     $user = new User();
     $user->username = 'admin';
     $user->email = 'admin@admin.com';
     $user->password = Hash::make('admin');
     $user->created_ip = getHostByName(getHostName());
     $user->save();
 }
开发者ID:GoatEli,项目名称:TechnicSolder,代码行数:26,代码来源:2013_02_27_184039_create_users_table.php

示例14: getIP

function getIP()
{
    $ip = $_SERVER['SERVER_ADDR'];
    if (PHP_OS == 'WINNT') {
        $ip = getHostByName(getHostName());
    }
    if (PHP_OS == 'Linux') {
        $command = "/sbin/ifconfig";
        exec($command, $output);
        // var_dump($output);
        $pattern = '/inet addr:?([^ ]+)/';
        $ip = array();
        foreach ($output as $key => $subject) {
            $result = preg_match_all($pattern, $subject, $subpattern);
            if ($result == 1) {
                if ($subpattern[1][0] != "127.0.0.1") {
                    $ip = $subpattern[1][0];
                }
            }
        }
    }
    return $ip;
}
开发者ID:Roveref,项目名称:www,代码行数:23,代码来源:qSimpleSending.php

示例15: getIpAddress

 /**
  * Get IP Address
  *
  * @return  string
  */
 public function getIpAddress()
 {
     return getHostByName(getHostName());
 }
开发者ID:startupwrench,项目名称:startupwrench,代码行数:9,代码来源:Simplyhired.php


注:本文中的getHostByName函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。