|
SAKURA Internet // サポート - オンラインマニュアル - さくらのレンタルサーバの主な仕様
|
<?php
header( "pragma: no-cache" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
header( "Cache-control: no-cache" );
// *********************************************************
// ユーザとパスワード
// *********************************************************
$username = 'ユーザー';
$password = 'パスワード';
// *********************************************************
// 対象ファイル
// ログインディレクトリからの相対位置
// *********************************************************
$url = 'winofsql.jp/www/homepage/download/WinOfSql102.lzh';
// *********************************************************
// URL
// *********************************************************
$ftp_server = "ftp://" . $username . ":" . $password . "@" . $url;
// *********************************************************
// 開始
// *********************************************************
$ch = curl_init();
// *********************************************************
// デバッグ用の詳しいメッセージを出力
// *********************************************************
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
$fpe = fopen("./debug.txt","w");
curl_setopt($ch, CURLOPT_STDERR, $fpe);
// *********************************************************
// 転送用のオプション
// *********************************************************
curl_setopt($ch, CURLOPT_URL, $ftp_server);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
// *********************************************************
// SSL である事の明示
// *********************************************************
curl_setopt($ch, CURLOPT_FTP_SSL, CURLFTPSSL_ALL);
// *********************************************************
// ダウンロードされるファイル
// *********************************************************
$fp = fopen("./target.lzh","w");
curl_setopt($ch, CURLOPT_FILE, $fp);
// *********************************************************
// 実行
// *********************************************************
curl_exec($ch);
// *********************************************************
// 終了
// *********************************************************
curl_close($ch);
// *********************************************************
// 後処理
// *********************************************************
fclose($fp);
fclose($fpe);
?>
OK
| |
|
* About to connect() to winofsql.jp port 21 (#0)
* Trying xx.xx.xx.xx... * connected
* Connected to winofsql.jp (xx.xx.xx.xx) port 21 (#0)
< 220 ProFTPD 1.3.2c Server (SAKURA Internet FTP Server) [xx.xx.xx.xx]
> AUTH SSL
< 234 AUTH SSL successful
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: O=*.sakura.ne.jp, CN=*.sakura.ne.jp, OU=Domain Control Validated
* start date: 2009-01-06 06:09:53 GMT
* expire date: 2019-01-06 06:09:53 GMT
* common name: *.sakura.ne.jp (does not match 'winofsql.jp')
* issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., OU=http://certificates.godaddy.com/repository, CN=Go Daddy Secure Certification Authority, serialNumber=07969287
* SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
> USER xx
< 331 Password required for xx
> PASS xx
< 230 User xx logged in
> PBSZ 0
< 200 PBSZ 0 successful
> PROT P
< 200 Protection set to Private
> PWD
< 257 "/xx/xx" is the current directory
* Entry path is '/xx/xx'
> CWD www
< 250 CWD command successful
> CWD homepage
< 250 CWD command successful
> CWD download
< 250 CWD command successful
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||63275|)
* Trying xx.xx.xx.xx... * connected
* Connecting to xx.xx.xx.xx (xx.xx.xx.xx) port 63275
> TYPE I
< 200 Type set to I
> SIZE WinOfSql102.lzh
< 213 1655373
> RETR WinOfSql102.lzh
< 150 Opening BINARY mode data connection for WinOfSql102.lzh (1655373 bytes)
* Doing the SSL/TLS handshake on the data stream
* SSL re-using session ID
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: O=*.sakura.ne.jp, CN=*.sakura.ne.jp, OU=Domain Control Validated
* start date: 2009-01-06 06:09:53 GMT
* expire date: 2019-01-06 06:09:53 GMT
* common name: *.sakura.ne.jp (does not match 'winofsql.jp')
* issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., OU=http://certificates.godaddy.com/repository, CN=Go Daddy Secure Certification Authority, serialNumber=07969287
* SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
* Maxdownload = -1
* Getting file with size: 1655373
* Remembering we are in dir "www/homepage/download/"
< 226 Transfer complete
* Connection #0 to host winofsql.jp left intact
> QUIT
< 221 Goodbye.
* Closing connection #0
|