Solved

Send/POST file contents with newlines to a web server

Posted on 2016-09-21
6
59 Views
Last Modified: 2016-09-21
Using command line bash on Linux, trying to find a solution which allows sending a file and it's contents, intact with newlines, etc, to another host.  Am finding countless examples and suggestions but not one that works for me at least, so far.

I won't bother posting all of the variations I've tried but here is the last I've tried.

curl -s --cacert /etc/ssl/certs/ca-certificates.crt -u "1234:4321" --data "@/tmp/testfile" https://domain.com/
> POST / HTTP/1.1
> Authorization: Basic MDgfYhfsDBfgfvfgOSgTssU0wam12V245b1daeGFrYVRBbmpSeW1EN2tNcVlXVXZrbUU=
> User-Agent: curl/7.38.0
> Host: domain.com
> Accept: */*
> Content-Length: 5603
> Content-Type: application/x-www-form-urlencoded
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 204 No Content
< Date: Tue, 20 Sep 2016 17:53:50 GMT
< Server: Apache
< Cache-Control: no-cache
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8

I've also read that you need to use -o for output which I've tried, etc etc. There must be way of doing this.

The resulting file on the remote host should contain the user name being used to send it.
So, in this case, 1234-testfile
0
Comment
Question by:Mark Lewis
  • 3
  • 3
6 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41809354
An HTTPS POST must be received on the remote computer by a program that can do something with it.  Sending it to the generic domain https://domain.com/ will never work unless there is an index file that knows what to do with the file.
0
 

Author Comment

by:Mark Lewis
ID: 41809382
What kind of code would be needed at the receiving end then? Let's just say a simply index.php/html file for example.
I would send it to a sub-directory which contains only that file.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41809461
An HTML file can't receive a POST, it can only display a page.  The basics for PHP can be found here: http://php.net/manual/en/features.file-upload.php
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:Mark Lewis
ID: 41809476
I meant an html/php file in terms of code, what is needed in order to receive the remote file.
I'm no programmer so cannot learn this from scratch but could start with a good example.
The link explains how this works but I could use an actual example of it which I could expand on.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41809482
I suggest that you hire a programmer.  The code on that page is a good example.
0
 

Author Comment

by:Mark Lewis
ID: 41809487
It's something I want to do myself and usually can with a good example.
I'll post another related question asking for example code.

I'll award this as a solution to help anyone else who finds it.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

#SSL #TLS #Citrix #HTTPS #PKI #Compliance #Certificate #Encryption #StoreFront #Web Interface #Citrix XenApp
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now