0

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

thanks

macki
  • 904
  • 7
  • 12
  • 1
    What kind of authentication must pass between client and server? Htaccess or otherwise? – jakx Nov 14 '11 at 19:25
  • Standard HTTP basic authentication? form-based login? captchas? – Marc B Nov 14 '11 at 19:42
  • possible duplicate of [cUrl Login then cUrl Download](http://stackoverflow.com/questions/6987876/curl-login-then-curl-download) – mario Nov 14 '11 at 19:44
  • see also [search: php curl upload after login](http://stackoverflow.com/search?q=php%20curl%20upload%20after%20login) – mario Nov 14 '11 at 19:45
  • @macki added an edit to show you how to send post data using CURL – jakx Nov 14 '11 at 21:47
  • @macki do you have any questions? EDIT: to clarify you want to make curl --data "birthyear=1905&press=%20OK%20" match the variable expecting login name and password and make sure they are correct. – jakx Nov 15 '11 at 17:27

1 Answers1

0

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.

jakx
  • 748
  • 5
  • 8