download web page from c

W

Will

Hi,

I am wondering is it possible to open a web page with c? I have been
looking for a way to do this for sometime.

Ideally it would be great to have somthing like

FILE *webpage = fopen("http://www.server.com/dir1/dir2/page.html",
"r");

Is this possible? Or are there other ways around this? Also perhaps
there is a lib i can install that would allow this?

Reagrds
Will
 
A

Alipha

Will said:
Hi,

I am wondering is it possible to open a web page with c? I have been
looking for a way to do this for sometime.

Ideally it would be great to have somthing like

FILE *webpage = fopen("http://www.server.com/dir1/dir2/page.html",
"r");

Is this possible? Or are there other ways around this? Also perhaps
there is a lib i can install that would allow this?

Reagrds
Will

see the curl library. or to reinvent the wheel, see beej's for a socket
tutorial and the http rfc.
 
M

Malcolm

Will said:
Ideally it would be great to have somthing like

FILE *webpage = fopen("http://www.server.com/dir1/dir2/page.html",
"r");

Is this possible? Or are there other ways around this? Also perhaps
there is a lib i can install that would allow this?
It would be lovely if someone did implement an fopen() that would take URLs
transparently.

Unfortunately you normally have to mess about with non-standard socket
libraries and the like to get internet connectivity out of C.
 
K

Keith Thompson

Will said:
I am wondering is it possible to open a web page with c? I have been
looking for a way to do this for sometime.

Ideally it would be great to have somthing like

FILE *webpage = fopen("http://www.server.com/dir1/dir2/page.html",
"r");

Is this possible? Or are there other ways around this? Also perhaps
there is a lib i can install that would allow this?

There is no portable way to do this. On the other hand, an
implementation could support URLs as file names; the C standard says
very little about how file names are interpreted.

Your best bet is to post to a newsgroup that covers your operating
system.
 
D

Default User

Will said:
Hi,

I am wondering is it possible to open a web page with c? I have been
looking for a way to do this for sometime.

Ideally it would be great to have somthing like

FILE *webpage = fopen("http://www.server.com/dir1/dir2/page.html",
"r");

Is this possible? Or are there other ways around this? Also perhaps
there is a lib i can install that would allow this?


My recommendation is to use PHP for this sort of thing. That's what
that language is designed for.



Brian
 
W

Will

My prog. is intended to run as in the background of a unix shell and to
periodically check a website. And disp info to the terminal screen. Php
would be no use here...
 
K

Keith Thompson

Will said:
My prog. is intended to run as in the background of a unix shell and to
periodically check a website. And disp info to the terminal screen. Php
would be no use here...

What are you talking about? My server no longer has a copy of the
article to which you're replying (and it's not worth my time to go
hunting for it).

Since you're already using groups.google.com, search this newsgroup
for "context, dammit". You'll find an explanation of the problem and
instructions for avoiding it, and get a better idea of just how
tedious and annoying the whole thing has become.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,918
Members
47,458
Latest member
Chris#

Latest Threads

Top