简体   繁体   中英

php curl performing an sftp connection with my servers ip address

Am trying to perform an ftp connection to another server.

So currently i have done

$host="server_to_connet_ip"

ftp_connect ( $host [ 21 [, int $timeout = 90 ]] )

This works totally fine when the the server to connect to doesnt limit the ip address.

Currently there is a limit on the ip address that can connect to the server and my vps ip address has already been whitelisted How can i still perform the ftp connection with the origin ip address as my server ip address(where application is hosted) as currently each and every request i make happen to appear to be from my local computer outgoing ip address not the servers(where application is hosted) ip address

I have also checked on using curl as an alternative but i cannot figure out how.

SO in curl this would be something like

curl ftp://serverip --user myname:mypassword 

But how can this be achieved in such away that when performing the ftp connection request the request will originate from my server ip address(when i host my application) not my local computer ip address.

You can't, it's not possible to spoof an IP and receive a response because the response will go to the IP that you spoofed and you aren't actually calling from there.

You need to add the IP that you will be connecting from to the whitelist on the server you are connecting to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM