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 996283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:51:14+00:00 2026-05-16T06:51:14+00:00

I have 2 servers. And i want to transfer a file from one server

  • 0

I have 2 servers. And i want to transfer a file from one server to an other with cURL. Can anyone show me a good example of this ? What options should I give to cURL …..

Thx.

  • 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-05-16T06:51:15+00:00Added an answer on May 16, 2026 at 6:51 am

    sender.php

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 1);
    // true to return the transfer as a string of the return value
    // of 'curl_exec' instead of outputting it directly
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
    curl_setopt($ch, CURLOPT_URL, 'http://localhost/test/curl/receiver.php');
    curl_setopt($ch, CURLOPT_POST, true);
    $post = array(
      'euro' => '@eurodance.pls',
      'flush' => '@flush_next.png',
      'first_name' => 'Vadim'
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $response = curl_exec($ch);
    print_r($response);
    

    receiver.php

    if(isset($_FILES)){
      $temp_file_name = $_FILES['euro']['tmp_name'];
      $original_file_name = $_FILES['euro']['name'];
    
      // Find file extention
      $ext = explode ('.', $original_file_name);
      $ext = $ext [count ($ext) - 1];
    
      // Remove the extention from the original file name
      $file_name = str_replace ($ext, '', $original_file_name);
    
      $new_name = '_'.$file_name . $ext;
    //echo $file_name ." ". $ext;
    
      if (move_uploaded_file ($temp_file_name, $new_name)) {
          echo "success";
       } else {
          echo "error";
        }
    
    }
    if(isset($_FILES)){
      $temp_file_name = $_FILES['flush']['tmp_name'];
      $original_file_name = $_FILES['flush']['name'];
    
      // Find file extention
      $ext = explode ('.', $original_file_name);
      $ext = $ext [count ($ext) - 1];
    
      // Remove the extention from the original file name
      $file_name = str_replace ($ext, '', $original_file_name);
    
      $new_name = '_'.$file_name . $ext;
    //echo $file_name ." ". $ext;
    
      if (move_uploaded_file ($temp_file_name, $new_name)) {
          echo "success";
       } else {
          echo "error";
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to ask, why I cannot transfer file from server to client? When
I have a couple of servers and a load balancer. I want to show
We have a server application that we want to restrict non-users from triggerring it
I have a server application which I want to protect from being stopped by
Hello every one I want to ask a question about file transfer using sockets.
My goal is to transfer entries from one ldap server to another - preserving
I am new to java and I have to transfer file from Android application
I'm making a file transfer application between (client-server) and have the tools I need
i making a file transfer (server-client) application .. i have two listviewS to explore
We have a staged environment with 1 CMS and 3 Slave servers I want

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.