Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: Http in C?

Reply
Thread Tools

Re: Http in C?

 
 
Malcolm McLean
Guest
Posts: n/a
 
      06-27-2013
On Thursday, June 27, 2013 7:17:08 PM UTC+1, Bertram wrote:
>
> Do you know if is possible in C, open HTTP connection through a URL,
> download a page in ASCII text or a foto.jpeg
>

Yes, it's rather a hassle because the libraries are non-standard and a bit
difficult to use. But it's certainly achievable.
 
Reply With Quote
 
 
 
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      06-27-2013
Malcolm McLean <(E-Mail Removed)> wrote:
> On Thursday, June 27, 2013 7:17:08 PM UTC+1, Bertram wrote:


>> Do you know if is possible in C, open HTTP connection through a URL,
>> download a page in ASCII text or a foto.jpeg


> Yes, it's rather a hassle because the libraries are non-standard and a bit
> difficult to use. But it's certainly achievable.


Well, there are wget and curl, which might have been written in C.

Easier to run one of them than to write one, though.

-- glen
 
Reply With Quote
 
 
 
 
JohnF
Guest
Posts: n/a
 
      06-28-2013
glen herrmannsfeldt <(E-Mail Removed)> wrote:
>> Bertram wrote:
>>> Do you know if is possible in C, open HTTP connection through a URL,
>>> download a page in ASCII text or a foto.jpeg

>
> Well, there are wget and curl, which might have been written in C.
> Easier to run one of them than to write one, though. glen


Exactly... very easy to just run. I do this sort of thing all
the time: just FILE *wget = popen("wget -q -O - http://etc","r");
where the "-O -" part makes wget send its output to stdout,
and then you can just fgets(,,wget) until NULL in the usual way,
and then just pclose(wget). The binary jpg stuff might
preferably use fgetc or some other mechanism (I haven't needed
to do that), but I'm sure you get the idea.
Of course, this isn't really "doing it in C", per se,
but I've never heard anybody ask this question for purist purposes.
Rather, it's always been somebody wanted to download something
into their C program for further processing of some sort. And this
gets that job done real well (for me, anyway).
--
John Forkosh ( mailto: http://www.velocityreviews.com/forums/(E-Mail Removed) where j=john and f=forkosh )
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/822319ev1'. 'HTTP/1.1 500 Internal Server Error'. chanmm ASP .Net 2 09-07-2010 07:37 AM
Split Tunnel Blocks http through tunnel but passes http around tunnel a.nonny mouse Cisco 2 09-19-2004 12:10 AM
Getting "HTTP Error 403 - Forbidden" at http://localhost/quickstart/ASPPlus/ Scott MCSD 1 08-04-2004 05:28 PM
HttpModule -- how to intercept urls like http://localhost/abc/def or http://localhost/abc/def/ where abc, def are non virtual dir Jiong Feng ASP .Net 0 11-19-2003 05:29 AM



Advertisments