Reputation: 186
I'm trying to get a file from a public ftp server via file_get_contents
.
$url = 'ftp://ftp.server.de/my_file.txt';
echo file_get_contents($url);
I get the following error:
file_get_contents(): connect() failed: No route to host
allow_url_fopen
is enabled.
What could be the problem?
Upvotes: 1
Views: 5479
Reputation: 186
It was a firewall issue.
The PHP ftp wrapper uses only passive mode. So all ports have to be open.
Upvotes: 3
Reputation: 430
$url = 'www://ftp.server.de/my_file.txt';
$file = file_get_contents($url, true);
Try this
Upvotes: -1