Using file_get_contents and ftp_put
<p>Is there a way we can use file_get_contents then ftp file upload the file fetched from file_get_contents to the remote site?</p>

<p>I have the code below but I am getting error:</p>

<pre><code>&lt;?php
ob_start();

$file = 'http://test4.*****.com/';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "John Smith\n";


$host = 'ftp.******.com';
$usr = '*******';
$pwd = '*******';        
$local_file = $current;
$ftp_path = 'test4/resources-test.php';
$conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");     

ftp_pasv($conn_id, true);
ftp_login($conn_id, $usr, $pwd) or die("Cannot login");
// perform file upload
ftp_chdir($conn_id, '/public_html/');
$upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII);
if($upload) { $ftpsucc=1; } else { $ftpsucc=0; }
// check upload status:
print (!$upload) ? 'Cannot upload' : 'Upload complete';
print "\n";
// close the FTP stream
ftp_close($conn_id);

ob_end_flush();

?&gt;
</code></pre>

<p>Below is all the error I'm getting:</p>

<pre><code>Warning: ftp_put(&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
</code></pre>

<p>It cuts off after this...</p>
