Wholesale Drop Ship Suppliers - Loan - Free Advertising - Web Advertising - Hotels in Krakow

PDA

View Full Version : Quick PHP FTP help


cpufreak3
Feb 6th 2008, 4:48 pm
I'm trying to use the ftp_connect in PHP, but would like to change the port.

Here's what I have ftp_connect('www.blockfilter.info', 22);

However, it doesn't work. I can connect without the port number, and I know I have sftp access. I think my formatting may be wrong. Thanks

EDIT: Let me clarify, I would like to connect via SFTP in PHP, how exactly do I do this?

webwurks
Feb 6th 2008, 5:09 pm
The server you are attempting to connect with must be configured to accept ftp connections on the port (22) you wish to use before you can connect to it.
Typically FTP access is set up for port 21

cpufreak3
Feb 6th 2008, 6:34 pm
Figured it out, I needed a PHP extension for SFTP.

Richard R
Feb 6th 2008, 6:49 pm
Hi,

<?php
// configuration
$host = "www.blockfilter.info";
$port = 21;

// connect or die.
ftp_connect($host, $port) or die("Could not connect to $host");

?>

If you would like something a little more advance, send me a PM.

edit: i see you resolved it, hadn't refreshed.

cpufreak3
Feb 6th 2008, 7:14 pm
No problem, thanks for the help, though.