Jump to content

Recommended Posts

You can't write a script that sits on the server and forces a download to the client!!!! It would be a very dangerous world if that were common place.

The best you could do is e-mail the file as an attachment. At least you can do that in a cron job and still not have to worry about the destination machine being on or not.
Link to comment
https://forums.phpfreaks.com/topic/5059-getfile/#findComment-18682
Share on other sites

ok now im getting problems with that. i get this error

[code]Parse error: parse error, unexpected T_DNUMBER, expecting T_VARIABLE or '$' in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 8[/code]

useing this code (but with pass login and server ip)

[code]<?php

// define some variables
$local_file = 'local.zip';
$server_file = 'server.zip';

// set up basic connection
$conn_id = ftp_connect($***.***.**.***);

// login with username and password
$login_result = ftp_login($conn_id, $******, $******);

// try to download $server_file and save to $local_file
if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
   echo "Successfully written to $local_file\n";
} else {
   echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/5059-getfile/#findComment-18874
Share on other sites

i took it away and still have the error. i found out that if i take away the decimals i get this error

[code]Warning: ftp_connect(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 8

Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 11

Warning: ftp_get() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 14
There was a problem
Warning: ftp_close() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 21[/code]

ps. this is a game server and the ip: 195.149.21.123 and this works in smart ftp and in the windows network thing but im not sure if its right for this :S
Link to comment
https://forums.phpfreaks.com/topic/5059-getfile/#findComment-18895
Share on other sites

ok i can feel that were clos now, but im getting this error

[code]Warning: ftp_login(): Please tell me who you are in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 11

Warning: ftp_get(): Error opening mani_ranks.txt in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 14
There was a problem[/code]

could this be to do with the conn_id thing?
Link to comment
https://forums.phpfreaks.com/topic/5059-getfile/#findComment-19136
Share on other sites

ok so now it takes ages to load whitch at first i was happy about but once it had done i get this error

[code]
Warning: ftp_login() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 11

Warning: ftp_get() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 14
There was a problem
Warning: ftp_close() expects parameter 1 to be resource, boolean given in /home/rmmsclan/public_html/main/mani_stats/ranks/index.php on line 21[/code]

... what im i doing now?

also it overwrites the old file with an empty one
Link to comment
https://forums.phpfreaks.com/topic/5059-getfile/#findComment-19767
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.