• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / ftp_base::SetServer() –

You appear to be a bot. Output may be restricted

Description

Usage

ftp_base::SetServer( $host, $port, $reconnect );

Parameters

$host
( mixed ) required –
$port
( mixed ) optional default: 21 –
$reconnect
( mixed ) optional default: 1 –

Returns

void

Source

File name: wordpress/wp-admin/includes/class-ftp.php
Lines:

1 to 32 of 32
  function SetServer($host, $port=21, $reconnect=true) {
    if(!is_long($port)) {
          $this->verbose=true;
          $this->ftp_base::SendMSG("Incorrect port syntax");
      return FALSE;
    } else {
      $ip=@gethostbyname($host);
          $dns=@gethostbyaddr($host);
          if(!$ip) $ip=$host;
          if(!$dns) $dns=$host;
          // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false
          // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid
          $ipaslong = ip2long($ip);
      if ( ($ipaslong == false) || ($ipaslong === -1) ) {
        $this->ftp_base::SendMSG("Wrong host name/address \"".$host."\"");
        return FALSE;
      }
          $this->_host=$ip;
          $this->_fullhost=$dns;
          $this->_port=$port;
          $this->_dataport=$port-1;
    }
    $this->ftp_base::SendMSG("Host \"".$this->_fullhost."(".$this->_host."):".$this->_port."\"");
    if($reconnect){
      if($this->_connected) {
        $this->ftp_base::SendMSG("Reconnecting");
        if(!$this->ftp_base::quit(FTP_FORCE)) return FALSE;
        if(!$this->ftp_base::connect()) return FALSE;
      }
    }
    return TRUE;
  }
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: ftp_base::SetServer
Class ref: ftp_base
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-admin/includes/class-ftp.php
File ref: wp-admin/includes/class-ftp.php
Deprecated?: No
API Letters: B,F,S

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites