syaiful bahri
syaiful bahri

Reputation: 3

Create a file and save it to another server

I create a json file and save it in my server where my script save.

<?
$format='epub_text';
$ver='1.0.0';

$posts = array('content_id'=> $dir,'content_version'=> $ver,'content_name'=> $title, 'content_format'=> $format);

$response = $posts;
$nama_file= $dir.'.json';
$fp = fopen($nama_file, 'w');
fwrite($fp, json_encode($response));
fclose($fp);
?>

After save it I need to copy the file result to another server, a ftp server . Any advice how to do it?

Upvotes: 0

Views: 109

Answers (1)

Lusitanian
Lusitanian

Reputation: 11122

To use FTP in PHP, you can use cURL. Here's a tutorial straight from the developers of the library :)

Upvotes: 3

Related Questions