Home >Backend Development >PHP Tutorial >php test ftp connection

php test ftp connection

WBOY
WBOYOriginal
2016-08-08 09:20:321227browse

php test ftp connection script is as follows:

<?php
    $host = "xxx.xxx.xxx.xxx";
    $user = "username";
    $pwd = "password";
    $port = "21"; 
    $conn   = @ftp_connect($host, $port) ;

    if($conn == false) {
        echo "conn fail!";
    } else {
        echo "conn success!";
    }

    $login = @ftp_login($conn, $user, $pwd);
    if(empty($login)) {
        echo "login fail!";
    } else {
        echo "login success!";
    }
?>


Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces the PHP test ftp connection, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn