Sponsored Content
Top Forums Shell Programming and Scripting Access a complete flow with CURL + bash shell Post 303019271 by apmcd47 on Tuesday 26th of June 2018 06:21:40 AM
Old 06-26-2018
java? I thought you were using bash.

Curl has an option, -c in its short form, --cookie-jar in its long form, to save cookies:
Code:
curl --cookie-jar my-cookies http://some.url.com

Can you not use that to save the cookies, and read the file for the cookies you are interested in?

The curl man page can be found here.

Andrew
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

BASH complete-filename & menu-complete together

Hi, Does anyone know how to make BASH provide a list of possible completions on the first tab, and then start cycling through the possibilites on the next tab? Right now this is what I have in my .bashrc: bind "set show-all-if-ambiguous on" bind \\C-o:menu-complete This allows... (0 Replies)
Discussion started by: Mithu
0 Replies

2. Shell Programming and Scripting

Bash script idea using cUrl -- possible?

I have an alias already in my .bash_profile to download files using cUrl's -o (output to file, user provides the file name) option. I find I'm using it quite a bit, so I wanted to write a script to run "curl -o", taking the necessary inputs - file name and URL from which to download - and then... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

3. Shell Programming and Scripting

bash curl escape & in url

I'm running a curl command in bash, but the & in the middle causes the second half of the line to run in the background, here's what I'm trying to do: lat="37.451" lon="-122.18" url="http://ws.geonames.org/findNearestAddress?lat=$lat&lng=$lon" curl -s "$url" I tried escaping the & with \&,... (4 Replies)
Discussion started by: unclecameron
4 Replies

4. Shell Programming and Scripting

Using Curl to Access PayPal

can anyone please help me with this? i know paypal is a secure site, so a code like the below would be needed. but that's where i get stuck. curl -s -K https://www.paypal.com I need to be able to curl to paypal and download a list of latest purchases. i know there HAS to be a way to do... (0 Replies)
Discussion started by: SkySmart
0 Replies

5. Shell Programming and Scripting

Help with make sure shell script execute instruction in flow

Hi, I want to write a shell script to make sure all the instruction is executive in flow. eg. I want my shell script to run finish this two progress first: ./program input_file_1.txt > input_file_1.txt.out & ./program input_file_2.txt > input_file_2.txt.out & After then, only run the... (1 Reply)
Discussion started by: edge_diners
1 Replies

6. Shell Programming and Scripting

Help with control flow in a Bash script

In my bash script I want to say "if argument 2 is anything except x, y or z, than echo this" (x y and z being words). So my script looks like this: if ] then echo "unrecognized input: $2" fi This usually works but than I also want to say "if argument 2 IS x, y, or z, but argument 4 is... (4 Replies)
Discussion started by: Jrodicon
4 Replies

7. Red Hat

Bash: menu-complete and reverse

Hi, In the archives I found this: And this works fine. $if mode=vi "\C-0-": digit-argument TAB: menu-complete "\e But what I want is to reverse this. So I want that tab does reverse menu completion and shift tab does normal menu completion. Can anyone help me with this? Thanks (0 Replies)
Discussion started by: ozkanb
0 Replies

8. Shell Programming and Scripting

Curl won't complete in a script but does from prompt. Idea?

On RHEL5 from within both a shell (sh->bash) and a csh script curl fails with a "curl: (6) Couldn't resolve host 'application'" error. This is the result whether run as a command at the shell and/or c-shell prompt and curl also fails with the same error when the scripts are "source'd" at the... (5 Replies)
Discussion started by: GSalisbury
5 Replies

9. Shell Programming and Scripting

Using curl in bash script

Hello. I have pick up a script from internet to track errors from curl command. #!/bin/bash # URL_TO_TEST="http://www.xxxxxx.yyy" MY_VAR=curl_init("$URL_TO_TEST") ; curl_setopt($MY_VAR, CURLOPT_HEADER, 1); curl_setopt($MY_VAR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($MY_VAR,... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

Access a complete flow with CURL + bash shell

Hello Experts , I have an use case which needed your help . I have been using google for 2 days buy couldn`t succed , i believe i can get the help here. Here is my use case to run on bash shell 1. Access an URL -- in script , it will be mentioned as inputURL 2. Once i accessed the URL... (1 Reply)
Discussion started by: radha254
1 Replies
HTTP::Cookies(3)					User Contributed Perl Documentation					  HTTP::Cookies(3)

NAME
HTTP::Cookies - HTTP cookie jars SYNOPSIS
use HTTP::Cookies; $cookie_jar = HTTP::Cookies->new( file => "$ENV{'HOME'}/lwp_cookies.dat", autosave => 1, ); use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar($cookie_jar); Or for an empty and temporary cookie jar: use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar( {} ); DESCRIPTION
This class is for objects that represent a "cookie jar" -- that is, a database of all the HTTP cookies that a given LWP::UserAgent object knows about. Cookies are a general mechanism which server side connections can use to both store and retrieve information on the client side of the connection. For more information about cookies refer to <URL:http://curl.haxx.se/rfc/cookie_spec.html> and <URL:http://www.cookiecentral.com/>. This module also implements the new style cookies described in RFC 2965. The two variants of cookies are supposed to be able to coexist happily. Instances of the class HTTP::Cookies are able to store a collection of Set-Cookie2: and Set-Cookie: headers and are able to use this information to initialize Cookie-headers in HTTP::Request objects. The state of a HTTP::Cookies object can be saved in and restored from files. METHODS
The following methods are provided: $cookie_jar = HTTP::Cookies->new The constructor takes hash style parameters. The following parameters are recognized: file: name of the file to restore cookies from and save cookies to autosave: save during destruction (bool) ignore_discard: save even cookies that are requested to be discarded (bool) hide_cookie2: do not add Cookie2 header to requests Future parameters might include (not yet implemented): max_cookies 300 max_cookies_per_domain 20 max_cookie_size 4096 no_cookies list of domain names that we never return cookies to $cookie_jar->add_cookie_header( $request ) The add_cookie_header() method will set the appropriate Cookie:-header for the HTTP::Request object given as argument. The $request must have a valid url attribute before this method is called. $cookie_jar->extract_cookies( $response ) The extract_cookies() method will look for Set-Cookie: and Set-Cookie2: headers in the HTTP::Response object passed as argument. Any of these headers that are found are used to update the state of the $cookie_jar. $cookie_jar->set_cookie( $version, $key, $val, $path, $domain, $port, $path_spec, $secure, $maxage, $discard, \%rest ) The set_cookie() method updates the state of the $cookie_jar. The $key, $val, $domain, $port and $path arguments are strings. The $path_spec, $secure, $discard arguments are boolean values. The $maxage value is a number indicating number of seconds that this cookie will live. A value <= 0 will delete this cookie. %rest defines various other attributes like "Comment" and "CommentURL". $cookie_jar->save $cookie_jar->save( $file ) This method file saves the state of the $cookie_jar to a file. The state can then be restored later using the load() method. If a filename is not specified we will use the name specified during construction. If the attribute ignore_discard is set, then we will even save cookies that are marked to be discarded. The default is to save a sequence of "Set-Cookie3" lines. "Set-Cookie3" is a proprietary LWP format, not known to be compatible with any browser. The HTTP::Cookies::Netscape sub-class can be used to save in a format compatible with Netscape. $cookie_jar->load $cookie_jar->load( $file ) This method reads the cookies from the file and adds them to the $cookie_jar. The file must be in the format written by the save() method. $cookie_jar->revert This method empties the $cookie_jar and re-loads the $cookie_jar from the last save file. $cookie_jar->clear $cookie_jar->clear( $domain ) $cookie_jar->clear( $domain, $path ) $cookie_jar->clear( $domain, $path, $key ) Invoking this method without arguments will empty the whole $cookie_jar. If given a single argument only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If given three arguments, then the cookie with the specified key, path and domain is removed. $cookie_jar->clear_temporary_cookies Discard all temporary cookies. Scans for all cookies in the jar with either no expire field or a true "discard" flag. To be called when the user agent shuts down according to RFC 2965. $cookie_jar->scan( &callback ) The argument is a subroutine that will be invoked for each cookie stored in the $cookie_jar. The subroutine will be invoked with the following arguments: 0 version 1 key 2 val 3 path 4 domain 5 port 6 path_spec 7 secure 8 expires 9 discard 10 hash $cookie_jar->as_string $cookie_jar->as_string( $skip_discardables ) The as_string() method will return the state of the $cookie_jar represented as a sequence of "Set-Cookie3" header lines separated by " ". If $skip_discardables is TRUE, it will not return lines for cookies with the Discard attribute. SEE ALSO
HTTP::Cookies::Netscape, HTTP::Cookies::Microsoft COPYRIGHT
Copyright 1997-2002 Gisle Aas This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.2 2012-02-15 HTTP::Cookies(3)
All times are GMT -4. The time now is 09:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy