Note Submitter: vladimir at pixeltomorrow dot com
----
When you're trying to activate passive mode using the ftp
raw command PASV, you can process the reply using the
following regular expression:
<?php
$rule =
'/^[0-9]+s.*(([0-9,]+),([0-9]+),([0-9]+)).*$/im';
// $ftp_server_reply is considered the reply provided
// by the FTP server.
if (preg_match($rule, $ftp_server_reply, $m)) {
$passive_host = str_replace(',', '.', $m[1]);
$passive_port = $m[2]*256+$m[3];
}
?>
Then you can open a stream where you can send the file you
want to upload, or the data you want to operate.
This post over here explains how things work with the FTP
passive mode, in a friendly way: http://tinyurl.com/2bwuqs
a>
Cheers,
Vladimir
http://www.TopNotchCoder
.com
P.S. Passive mode means opening a new connection where data
is being sent when uploading files, that's why it has to be
initiated after login, considering the logical order of
actions: Login -> CWD -> upload stuff.
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|