I can't connect ftp

Hi, I need some help please, I want to connect to ftp server but the problem is I need to use proxy,

FTP credentials

  Address: XXX.XXX.XXX.XXX
 username: theftpusername
 password: theftppassword

Then I have this proxy setup by our administrtor which can access to the ftp server

host: sample.myproxy.com 

Then in my php script

$ftp_server_proxy = 'sample.myproxy.com ';
$ftp_server_proxy_port = ‘8080’;

$conn_id = ftp_connect($$ftp_server_proxy,$ftp_server_proxy_port) or die("Couldn't connect to $ftp_server"); 

but it looks like I am ftping the proxy, I am confuse… can someone help me on this or is there other way not using ftp_connect ?

Thank you in avdvance

at least your $$ seems wrong.

See https://www.php.net/manual/en/context.ftp.php

Isn’t that the idea of a proxy server? You connect to that, and it forwards your connection to the actual server.

Well yes, but you do need to tell the proxy server what server you actually want to connect to.

That’s why your code should connect to the actual server, using the proxy in the stream context. See the link I posted earlier.

Hi I was confuse how to apply that context to my existing code…

Thank you in advance

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.