cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Need guidance using cURL and Apache authentication

From: Charles <cecrume_at_gmail.com>
Date: Mon, 10 May 2010 18:17:03 -0400

Pardon me for "jumping the gun" so to speak -- I replied directly to Ralph
late last night. My aplogies to Ralph and others if I shouldn't have done
that.

Anyway -- here's my current status on this

I appreciate the reply, but don't understand what you are trying to tell me.
I got out my cURL docs (the ones I chased down and printed off the web a
year or so ago).

I do not understand your combination of options. -o writes the data cURL
retrieves into a file (I have used this in other cURL scripts and then
manipulate the data via PHP).

I also think I understand -L -- it is supposed to instruct cURL to go to the
new page, right? But in my case it doesn't seem to be following to the page
I want.

I do not understand -w -- what is it actually doing? It seems to be in
direct conflict with -o

It's been a while since I've used UNIX (used to be a systems
administrator -- these days I run Windows NT servers). I remember that the
grave accents cause the shell to execute what's in them -- the cURL command
here -- but just what is being stored in EFFURL? I mean... if you use the -o
parameter why do you need EFFRUL -- isn't the output already stored in
"file.html"?

Thanks.

Charles...
-----------------------

[snip]

>
> I think the bit you're overlooking is that a browser will remember the url
> for the page it just fetched, and then apply that url to any relative
> links
> links it find in the page. You can mimic that (to some extent) in curl by
> using the -w option:
>
> EFFURL=`curl -s -S -L -w '%url_effective" -o file.html http://........`
>
> The page will be stored in page.html and the effective url, after
> redirects
> are followed, will be in the $EFFURL shell variable. Your script will
> still
> need to convert the relative urls to absolute, but at least you have the
> starting point.
>
> Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-11