Transfer in-memory data to FTP server without using intermediate file

后端 未结 2 520
天涯浪人
天涯浪人 2020-11-27 21:15

I am having some JSON data that I encoded it with PHP\'s json_encode(), it looks like this:

{
    \"site\": \"site1\",
    \"nbrSicEnt\": 85,
}
         


        
2条回答
  •  臣服心动
    2020-11-27 21:55

    According to Can you append lines to a remote file using ftp_put() or something similar? and Stream FTP Upload with PHP? you should be able to do something using either CURL or PHP's FTP wrappers using file_put_contents().

    $data = json_encode($object);
    file_put_contents("ftp://user:pass@host/dir/file.ext", $data, FILE_APPEND);
    

提交回复
热议问题