简体   繁体   English

PHP curl执行与我的服务器IP地址的SFTP连接

[英]php curl performing an sftp connection with my servers ip address

Am trying to perform an ftp connection to another server. 我正在尝试与另一台服务器建立ftp连接。

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. 当要连接的服务器不限制IP地址时,这完全可以正常工作。

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 当前对可以连接到服务器的IP地址有限制,并且我的vps ip地址已经被列入白名单。我如何仍可以使用原始ip地址作为我的服务器ip地址(托管应用程序)执行ftp连接(当前)我提出的每个请求似乎都是来自本地计算机的传出IP地址,而不是来自服务器(托管应用程序)的IP地址

I have also checked on using curl as an alternative but i cannot figure out how. 我还检查了使用curl作为替代方法,但我不知道如何做。

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. 但是如何做到这一点呢?当执行ftp连接请求时,请求将来自我的服务器ip地址(当我托管我的应用程序时)而不是我的本地计算机ip地址。

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. 您不能,不可能欺骗IP并接收响应,因为响应将转到您欺骗的IP,您实际上并没有从那里进行呼叫。

You need to add the IP that you will be connecting from to the whitelist on the server you are connecting to. 您需要将要连接的IP添加到要连接的服务器上的白名单中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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