Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8535515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:26:59+00:00 2026-06-11T10:26:59+00:00

I want to be able to transfer a php array from one server to

  • 0

I want to be able to transfer a php array from one server to another via ftp in the form of a file.

The receiving server needs to be able to open the said file and read its contents and use the array provided.

I’ve thought about going about this two ways, either writing a php file from server 1 with php code of an array then simply loading this file on server 2. However writing the said file is getting tricky when the depth of the array is unknown.

So I though about writing the array to the file json encoded but I don’t know how the second server could open and read the said data.

Could I simply do:

$jsonArray= json_encode($masterArray);
$fh = fopen('thefile.txt' , 'w');
fwrite($fh, $thePHPfile);
fclose($fh);

Then on the other server open the data into a variable:

$data = json_decode( include('thefile.txt') );

Has anyone had any experience of this before?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:27:00+00:00Added an answer on June 11, 2026 at 10:27 am

    For first server, connect to second server by FTP and put that file contents into a file

    $jsonArray = json_encode($masterArray);
    $stream    = stream_context_create(array('ftp' => array('overwrite' => true))); 
    file_put_contents('ftp://user:pass@host/folder/thefile.txt', $jsonArray, 0, $stream);
    

    use file_get_contents() for second server:

    $data = json_decode( file_get_contents('/path/to/folder/thefile.txt') );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to send Paypal an instruction, via PHP, to transfer
I want to be able to transfer values from one DataGridView in Form1 to
I want to be able to transfer a number of files (html, php, jpg,
I want to be able to transfer basic information (strings and such) from an
I want to call specific php function on server from Android application and also
I want to be able to do the following actions with a form submit
I want users of my c# application to be able to download a file
I wanted to know how would I be able to transfer files from linux
I would like to be able to hide another application's window from the taskbar,
I'm using LaTeX and BibTeX for an article, and I want to able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.