...
(the ftp is not what I am looking for artswerdstone - ty for looking tho)
You're welcome KennWort. If you're going to explain a bit more in details the purpose of the script, maybe you will get something that fits better that purpose.
You wrote you need a script that loads files from a site to a folder on your webhost.
If fxp doesn't fit your needs, then curl may be the solution, if your host supports curl. You have to check your host's PHPinfo if it contains cURL support enabled.
You may create with Notepad a file named phpinfo.txt with the following content:
Upload that file to your web folder, rename it to phpinfo.php, then run it by opening it in your web browser:
http://yoursite.com/phpinfo.php
Then read the results and check for the section "cURL".
If you have "cURL enabled", then you can use a curl script as per following sample:
Code:
<?php
/**
* Initialize the cURL session
*/
$ch = curl_init();
/**
* Set the URL of the page or file to download.
*/
curl_setopt($ch, CURLOPT_URL,
'http://yoursourcesite.com/yoursourcefile.pdf');
/**
* Create a new file
*/
$fp = [URL="http://www.php.net/fopen"]fopen[/URL]('yourtargetfile.pdf', 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);
/**
* Close cURL session and file
*/
curl_close ($ch);
[URL="http://www.php.net/fclose"]fclose[/URL]($fp);
?>
Replace "yoursourcesite.com/yoursourcefile.pdf" with whatever source file you want (this is your FROM statement).
Then replace "yourtargetfile.pdf" to the name you desire (this is your TO file, that will be located in the same folder with your above curl script).
Now make your file as per the above sample, name it "transfer.php" or any name you want, but with extension ".php". Upload it onto your website in your folder you want to transfer the file from your source.
Run the script either manualy, by calling it from your browser (hxxp://yoursite.com/download/transfer.php), or automatically by creating a cronjob that will execute the transfer.php script regularly at a given time.
It's not anything harder, then writing a DOS batch file, just go and do it. Success!