How to upload a file to another server using cURL and PHP?

Uploading to a remote server using PHP/CURL

  • Using PHP/CURL, how to upload a file to a remote server wherein the user must be logged in first? thanks

  • Answer:

    FYI CURL can pass authentication credentials along like this: curl --user USER:PASSWORD -s http://localhost:4848/monitoring/domain/server/transaction-service But it depends on what the server is expecting. EDIT: Here's how to send POST data: curl --data "birthyear=1905&press=%20OK%20" http://www.example.com/when.cgi Please ask if you have any questions.

macki at Stack Overflow Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.