By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,760 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,760 IT Pros & Developers. It's quick & easy.

Is there any library to get/fetch a remote URL?

P: n/a
Hi.

I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?

Thank you very much.
Nov 14 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Francesco Moi <fr**********@europe.com> scribbled the following:
Hi. I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html") Does exist any C library?


What's wrong with the answer already given by Jacob Navia?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"There's no business like slow business."
- Tailgunner
Nov 14 '05 #2

P: n/a
Francesco Moi <fr**********@europe.com> spoke thus:
I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")
Does exist any C library?


Not in standard C. If you're using *nix and wget is installed, you
might be able to do something like

system( "wget http://www.foo.com/foo.html" );

and then open the file with fopen() and proceed from there.

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #3

P: n/a
Joona I Palaste wrote:
Francesco Moi <fr**********@europe.com> scribbled the following:
Hi.


I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")


Does exist any C library?

What's wrong with the answer already given by Jacob Navia?


Yes, I would like to know too... :-)
Nov 14 '05 #4

P: n/a
fr**********@europe.com (Francesco Moi) writes:
I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?


There is no portable way to do this. For non-portable solutions,
consult your system documentation or, if that fails, ask in a
newsgroup specific to your system.

<OT>
On Unix-like systems, you might consider invoking the "wget" program
with appropriate arguments. Note that "wget" may or may not be
installed on a given system.
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #5

P: n/a
Christopher Benson-Manica <at***@nospam.cyberspace.org> writes:
Francesco Moi <fr**********@europe.com> spoke thus:
I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")
Does exist any C library?


Not in standard C. If you're using *nix and wget is installed, you
might be able to do something like

system( "wget http://www.foo.com/foo.html" );

and then open the file with fopen() and proceed from there.


Frankly, this is a good example of why it's best not to go into too
much detail when giving hints about system-specific solutions. Anyone
using this solution would have to be aware of the fact that wget by
default writes its file to the current directory, which might be
unwritable or nonexistent, or which might already have a file of the
same name. Such concerns are off-topic here, but perfectly
appropriate in one of the Unix groups such as comp.unix.programmer.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #6

P: n/a
Keith Thompson <ks***@mib.org> spoke thus:
Frankly, this is a good example of why it's best not to go into too
much detail when giving hints about system-specific solutions.


<ot>Well, obviously I didn't go into those details, did I? I
appreciate your concerns, but I don't think any great damage was done
by casually suggesting a possible solution along with the OT message
and links to the relevant clc documents.</ot>

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #7

P: n/a
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<cj**********@oravannahka.helsinki.fi>...
Francesco Moi <fr**********@europe.com> scribbled the following:
Hi.

I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?


What's wrong with the answer already given by Jacob Navia?


The answer is not related with "Standard C".

I thank the help, but I'm looking for another solution...
Nov 14 '05 #8

P: n/a
Francesco Moi wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<cj**********@oravannahka.helsinki.fi>...
Francesco Moi <fr**********@europe.com> scribbled the following:
Hi.

I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?


What's wrong with the answer already given by Jacob Navia?

The answer is not related with "Standard C".


<rant>
THEN THE QUESTION DOESN'T BELONG HERE!
</rant> I thank the help, but I'm looking for another solution...


Indeed.

--ag

--
Artie Gold -- Austin, Texas

"If you don't think it matters, you're not paying attention."
Nov 14 '05 #9

P: n/a
fr**********@europe.com (Francesco Moi) wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<cj**********@oravannahka.helsinki.fi>...
Francesco Moi <fr**********@europe.com> scribbled the following:
Hi.

I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?


What's wrong with the answer already given by Jacob Navia?


The answer is not related with "Standard C".

I thank the help, but I'm looking for another solution...


There is no ISO C answer. Jacob's answer is likely not of use to you
either, unless you're willing to lock yourself into his libraries, and
the way he's been talking about them here make me think that that would
be inadvisable. However, if you're able to use POSIX extensions (which,
if you've got a system capable of using HTTP like that, is quite
likely), comp.unix.programmer might be able to provide you with an
answer.

Richard
Nov 14 '05 #10

P: n/a
In article <ln************@nuthaus.mib.org>, Keith Thompson wrote:
fr**********@europe.com (Francesco Moi) writes:
I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?


There is no portable way to do this. For non-portable solutions,
consult your system documentation or, if that fails, ask in a
newsgroup specific to your system.

<OT>
On Unix-like systems, you might consider invoking the "wget" program
with appropriate arguments. Note that "wget" may or may not be
installed on a given system.
</OT>


You might want to try libcURL. In my experience, it's quite a nice
library, which is available for lots of platforms.

The url for curl (command-line program) and libcurl (the library)
is http://curl.haxx.se/

Cheers,
Ilja
--
Ilja Booij
IC&S B.V.
Nov 14 '05 #11

P: n/a
Artie Gold <ar*******@austin.rr.com> wrote in message news:<2s*************@uni-berlin.de>...
Francesco Moi wrote:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<cj**********@oravannahka.helsinki.fi>...
Francesco Moi <fr**********@europe.com> scribbled the following:

Hi.

I would like to fetch a remote URL by using C and get its
contents:
myfile = get("http://www.foo.com/foo.html")

Does exist any C library?

What's wrong with the answer already given by Jacob Navia?

The answer is not related with "Standard C".


<rant>
THEN THE QUESTION DOESN'T BELONG HERE!
</rant>
I thank the help, but I'm looking for another solution...


Indeed.

--ag


The answer I'm trying to find IS RELATED with "Standard C"
The answer given by Jacob Navia IS NOT RELATED with "Standard C".
Nov 14 '05 #12

P: n/a
Francesco Moi <fr**********@europe.com> scribbled the following:
Artie Gold <ar*******@austin.rr.com> wrote in message news:<2s*************@uni-berlin.de>...
Francesco Moi wrote:
> Joona I Palaste <pa*****@cc.helsinki.fi> wrote in message news:<cj**********@oravannahka.helsinki.fi>...
>>Francesco Moi <fr**********@europe.com> scribbled the following:
>>>Hi.
>>
>>>I would like to fetch a remote URL by using C and get its
>>>contents:
>>>myfile = get("http://www.foo.com/foo.html")
>>
>>>Does exist any C library?
>>
>>What's wrong with the answer already given by Jacob Navia?
>
>
> The answer is not related with "Standard C".
<rant>
THEN THE QUESTION DOESN'T BELONG HERE!
</rant>
> I thank the help, but I'm looking for another solution...


Indeed.

The answer I'm trying to find IS RELATED with "Standard C"
The answer given by Jacob Navia IS NOT RELATED with "Standard C".


The fact is, it is *IMPOSSIBLE* within the limits of Standard C to fetch
the contents of an URL, or to do anything else with the Internet or
other networking at all, for that matter. So Non-Standard C answers are
the best you're going to get.
Therefore I suggest you either start asking for platform-specific help
on platform-specific newsgroups (not on comp.lang.c) or forget about
the entire thing.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Last year he disrespected me - and then he showed lack of respect."
- Anthony Mason
Nov 14 '05 #13

P: n/a
On 6 Oct 2004 04:50:14 -0700, in comp.lang.c , fr**********@europe.com
(Francesco Moi) wrote:
Artie Gold <ar*******@austin.rr.com> wrote in message news:<2s*************@uni-berlin.de>...
>
> The answer is not related with "Standard C".
>

The answer I'm trying to find IS RELATED with "Standard C"


Yes, and you've already had an answer: "This can't be done in Standard C".
You need to carefully read all replies, even the ones you don't like.
The answer given by Jacob Navia IS NOT RELATED with "Standard C".


Indeed.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.