Re: problem with wget
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: problem with wget




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: problem with wget  
Victor Wagner


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-19-04 10:51 PM

olivier HARO <o.haro@en-compro.com> wrote:
: If thing you have not understood my problem
: I want to download a document based on my web server, that's why I use
: wget...  (popen doesn't understand http urls, Am I wrong?)
: The problem is that when I use the system(wget

But popen is able to run wget -O - <url>



http://xxxxxxx.com), the C
: program doesnt't wait the end of the system() function so that it implies

wget is able to detach itself from shell and put in the background.
Typically, it requires -b option in the command line.

Since system function does use shell, you could start wget in the
background with it.

Moreover, since system use shell, placing ampersand "&" at the end of
command line would place program into background. So, if your URL
contain some ampersands, it should be properly quoted.

try following code:

char wget_cmd [1024];
sprintf(wget_cmd,"wget '%s'",url);
system(wget_cmd)

(of course in real code you better use snprintf)




: bugs.....

Since for more than thirty years people used this function and it worked
for them, it seems that there is some misunderstanding on your part.

: Is there any wait to download a http document in C language by an other wa
y?
: Is there a solution to my problem?
: thanks! ;)

There are numerous ways to do it. Note that wget itself as well as lynx
and many other web access tools are written in C. (Mozilla and Opera are
written on C++ although)

There are numerous C libraries which handle client part of http
protocol.

But for simple case it is enough just to open socket to port 80 of your
web server, send there simple HTTP protocol command

"GET /mydocument.doc HTTP/1.1\nHost: www.myserver.com\n\n"

if you are going for http://www.myserver.com/mydocument.doc
and read everything which comes from server.


--





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:49 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register