Sponsored Content
Top Forums Shell Programming and Scripting Access a complete flow with CURL + bash shell Post 303019266 by apmcd47 on Tuesday 26th of June 2018 04:43:30 AM
Old 06-26-2018
Stupid question, but could you use the -c/--cookie-jar switch to save the cookies into a file?

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
Apache2::Cookie(3pm)					User Contributed Perl Documentation				      Apache2::Cookie(3pm)

NAME
Apache2::Cookie, Apache2::Cookie::Jar - HTTP Cookies Class SYNOPSIS
use Apache2::Cookie; $j = Apache2::Cookie::Jar->new($r); $c_in = $j->cookies("foo"); # get cookie from request headers $c_out = Apache2::Cookie->new($r, -name => "mycookie", -value => $c_in->name ); $c_out->path("/bar"); # set path to "/bar" $c_out->bake; # send cookie in response headers DESCRIPTION
The Apache2::Cookie module is based on the original 1.X versions, which mimic the CGI::Cookie API. The current version of this module includes several packages and methods which are patterned after Apache2::Request, yet remain largely backwards-compatible with the original 1.X API (see the "PORTING from 1.X" section below for known issues). This manpage documents the Apache2::Cookie and Apache2::Cookie::Jar packages. Apache2::Cookie::Jar This class collects Apache2::Cookie objects into a lookup table. It plays the same role for accessing the incoming cookies as Apache2::Request does for accessing the incoming params and file uploads. new Apache2::Cookie::Jar->new($env) Class method that retrieves the parsed cookie jar from the current environment. cookies $jar->cookies() $jar->cookies($key) Retrieve cookies named $key with from the jar object. In scalar context the first such cookie is returned, and in list context the full list of such cookies are returned. If the $key argument is omitted, "scalar $jar->cookies()" will return an APR::Request::Cookie::Table object containing all the cookies in the jar. Modifications to the this object will affect the jar's internal cookies table in "apreq_jar_t", so their impact will be noticed by all libapreq2 applications during this request. In list context "$jar->cookies()" returns the list of names for all the cookies in the jar. The order corresponds to the order in which the cookies appeared in the incoming "Cookie" header. This method will throw an "APR::Request::Error" object into $@ if the returned value(s) could be unreliable. In particular, note that "scalar $jar->cookies("foo")" will not croak if it can locate the a "foo" cookie within the jar's parsed cookie table, even if the cookie parser has failed (the cookies are parsed in the same order as they appeared in the "Cookie" header). In all other circumstances "cookies" will croak if the parser failed to successfully parse the "Cookie" header. $c = Apache2::Cookie->new($r, name => "foo", value => 3); $j->cookies->add($c); $cookie = $j->cookies("foo"); # first foo cookie @cookies = $j->cookies("foo"); # all foo cookies @names = $j->cookies(); # all cookie names status $jar->status() Get the APR status code of the cookie parser: APR_SUCCESS on success, error otherwise. Apache2::Cookie new Apache2::Cookie->new($env, %args) Just like CGI::Cookie::new, but requires an additional environment argument: $cookie = Apache2::Cookie->new($r, -name => 'foo', -value => 'bar', -expires => '+3M', -domain => '.capricorn.com', -path => '/cgi-bin/database', -secure => 1 ); The "-value" argument may be either an arrayref, a hashref, or a string. "Apache2::Cookie::freeze" encodes this argument into the cookie's raw value. freeze Apache2::Cookie->freeze($value) Helper function (for "new") that serializes a new cookie's value in a manner compatible with CGI::Cookie (and Apache2::Cookie 1.X). This class method accepts an arrayref, hashref, or normal perl string in $value. $value = Apache2::Cookie->freeze(["2+2", "=4"]); thaw Apache2::Cookie->thaw($value) $cookie->thaw() This is the helper method (for "value") responsible for decoding the raw value of a cookie. An optional argument $value may be used in place of the cookie's raw value. This method can also decode cookie values created using CGI::Cookie or Apache2::Cookie 1.X. print $cookie->thaw; # prints "bar" @values = Apache2::Cookie->thaw($value); # ( "2+2", "=4" ) as_string $cookie->as_string() Format the cookie object as a string. The quote-operator for Apache2::Cookie is overloaded to run this method whenever a cookie appears in quotes. ok "$cookie" eq $cookie->as_string; name $cookie->name() Get the name of the cookie. value $cookie->value() Get the (unswizzled) value of the cookie: my $value = $cookie->value; my @values = $cookie->value; Note: if the cookie's value was created using a "freeze" method, one way to reconstitute the object is by subclassing Apache2::Cookie with a package that provides the associated "thaw" sub: { package My::COOKIE; @ISA = 'Apache2::Cookie'; sub thaw { my $val = shift->raw_value; $val =~ tr/a-z/A-Z/; $val } } bless $cookie, "My::COOKIE"; ok $cookie->value eq "BAR"; raw_value $cookie->raw_value() Gets the raw (opaque) value string as it appears in the incoming "Cookie" header. ok $cookie->raw_value eq "bar"; bake $cookie->bake($r) Adds a Set-Cookie header to the outgoing headers table. bake2 $cookie->bake2($r) Adds a Set-Cookie2 header to the outgoing headers table. domain $cookie->domain() $cookie->domain($set) Get or set the domain for the cookie: $domain = $cookie->domain; $cookie->domain(".cp.net"); path $cookie->path() $cookie->path($set) Get or set the path for the cookie: $path = $cookie->path; $cookie->path("/"); version $cookie->version() $cookie->version($set) Get or set the cookie version for this cookie. Netscape spec cookies have version = 0; RFC-compliant cookies have version = 1. ok $cookie->version == 0; $cookie->version(1); ok $cookie->version == 1; expires $cookie->expires() $cookie->expires($set) Get or set the future expire time for the cookie. When assigning, the new value ($set) should match /^+?(d+)([YMDhms]?)$/ $2 qualifies the number in $1 as representing "Y"ears, "M"onths, "D"ays, "h"ours, "m"inutes, or "s"econds (if the qualifier is omitted, the number is interpreted as representing seconds). As a special case, $set = "now" is equivalent to $set = "0". my $expires = $cookie->expires; $cookie->expires("+3h"); # cookie is set to expire in 3 hours secure $cookie->secure() $cookie->secure($set) Get or set the secure flag for the cookie: $cookie->secure(1); $is_secure = $cookie->secure; $cookie->secure(0); httponly $cookie->httponly() $cookie->httponly($set) Get or set the HttpOnly flag for the cookie: $cookie->httponly(1); $is_HttpOnly = $cookie->httponly; $cookie->httponly(0); httponly $cookie->httponly() $cookie->httponly($set) Get or set the HttpOnly flag for the cookie: $cookie->httponly(1); $is_HttpOnly = $cookie->httponly; $cookie->httponly(0); comment $cookie->comment() $cookie->comment($set) Get or set the comment field of an RFC (Version > 0) cookie. $cookie->comment("Never eat yellow snow"); print $cookie->comment; commentURL $cookie->commentURL() $cookie->commentURL($set) Get or set the commentURL field of an RFC (Version > 0) cookie. $cookie->commentURL("http://localhost/cookie.policy"); print $cookie->commentURL; fetch Apache2::Cookie->fetch($r) Fetch and parse the incoming Cookie header: my $cookies = Apache2::Cookie->fetch($r); # APR::Request::Cookie::Table ref It should be noted, that with perl 5.8+ Iterator magic, table is able to handle multiple cookies of the same name. my %cookies = Apache2::Cookie->fetch($r); PORTING from 1.X Changes to the 1.X API: o "Apache2::Cookie::fetch" now expects an $r object as (second) argument, although this isn't necessary in mod_perl 2 if "Apache2::RequestUtil" is loaded and 'PerlOptions +GlobalRequest' is in effect. o "Apache2::Cookie::parse" is gone. o "Apache2::Cookie::new" no longer encodes the supplied cookie name. o "Apache2::Cookie::new()" returns undef if -value is not specified or -value => undef. o "name()" and "value()" no longer accept a "set" argument. In other words, neither a cookie's name, nor its value, may be modified. A new cookie should be made instead. SEE ALSO
Apache2::Request, APR::Request::Cookie, APR::Request::Error, CGI::Cookie(3) COPYRIGHT
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. perl v5.10.1 2010-11-25 Apache2::Cookie(3pm)
All times are GMT -4. The time now is 03:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy