LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-20-2014, 04:22 AM   #1
cutechaps
LQ Newbie
 
Registered: Feb 2014
Posts: 2

Rep: Reputation: Disabled
curl one liner


Hi

I am trying to write a curl one-liner that will help me to input the password after intiating the upload. Also this curl job needs to run on the background and transfer the verbose output to a file. So we can tail the file and check the status if required.

This is curl command that I am using now.

curl -T "#filename#" -u "username" "https://URL/upload/" -o log.txt -v -k


Thanks
 
Old 02-20-2014, 08:45 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Check out curl_setopt

I use curl_setopt to store "variables" specific to complex curl queries to an openfire remote host inside a .php file:
Yours could go something like this:
PHP Code:
<?php
curl_setopt
($curlCURLOPT_URL"https://URL/upload/");
curl_setopt($curlCURLOPT_HEADER0);
curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_ANY);
curl_setopt($curlCURLOPT_USERPWD'username:password');
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
curl_setopt($curlCURLOPT_VERBOSETRUE);
curl_setopt($curlCURLOPT_CAPATH'/etc/pki/tls/certs');
curl_setopt($curlCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($curlCURLOPT_SSL_VERIFYHOST0);
$data curl_exec($curl);
curl_close($curl);
echo 
$data;  // print the operation in the terminal
?>
and it's executed like so:
Code:
php -f /path/to/myfile.php
I'm not clear if "-v -k" is necessary since this snippet uses CURLOPT_SSL_VERIFYPEER, false.
YMMV

And Welcome to LQ.
 
Old 02-20-2014, 10:21 AM   #3
cutechaps
LQ Newbie
 
Registered: Feb 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks for the reply

But I am looking for simple one liner so that any user enter on the shell prompt.

-Thanks.
 
Old 02-20-2014, 10:59 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
http://www.commandlinefu.com/command.../sort-by-votes

suggests that

Code:
curl -T "#filename#" -u username --silent "https://URL/upload/"
upload and logging?

Maybe
Code:
$(curl -T "#filename#" -u username --silent "https://URL/upload/") -o log.txt -v -k
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fixed one-liner timer. stf92 General 7 10-18-2013 12:47 AM
one liner to create a value and then search casperdaghost Linux - Software 3 11-10-2009 12:08 AM
awk one liner help niknak Linux - Newbie 1 05-07-2009 04:52 AM
IP Forward one-liner? JoeBleaux Linux - Networking 1 04-27-2009 10:24 AM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration