Reading from a website?

This is a discussion on Reading from a website? within the C++ Programming forums, part of the General Programming Boards category; 1234...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    167

    Delete

    1234
    Last edited by Paul22000; 11-13-2008 at 02:06 AM.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,674
    Easiest thing to do is just call WGET from within you program.

    http://faq.cprogramming.com/cgi-bin/...&id=1043284392
    See option 3 for *nix.

    gg

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Paul22000 View Post
    Sorry, I'm not sure I follow. I don't see wget on the page?

    Also, if I call WGET, can I send it over a network, or can it only download to the directory it's in?
    So, did you read the link at all, or just start typing? And I would expect wget would be able to write anywhere you have write privileges.
    Last edited by tabstop; 11-12-2008 at 03:03 PM.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Paul22000 View Post
    Sorry, I read section 3 but I don't understand the code.

    I also did a ctrl+F in Firefox and typed in WGET, and it didn't find it. Perhaps I am typing in the wrong thing. Where is that section?
    Since the whole point is how to call any other program from the one you're in, the idea that you expect to find "wget" on the page is puzzling to me.

    As to the example, notice that the "child" routine is given at the top of the page. That program is run from the parent program.

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Code:
    webaddress.sin_addr.s_addr = inet_addr("http://www.google.com/index.html");
    Ha ha ha. Have you looked at what inet_addr actually does?

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Paul22000 View Post
    Oh yeah, I'll take off the index.html

    [Edit]: Damn, no go
    Did you expect that to help? Not all man pages are as clear as others, but inet_addr takes an internet address in dotted decimal format, not in fully qualified domain name form.

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Paul22000 View Post
    Oh, I thought the URL of a website would get the IP. No?

    Well, do I have the general idea at least?

    How do I get the ip from the url?

    Sorry, I am not so good with this, just started with socket programming yesterday =\
    Ever heard of DNS?

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    DNS stands for DoNnut Sale. It is where Al Gore (the official inventor of the internet) manually connects you to the website you wish to visit by feeding him a donut in exchange for the return of the IP of the website. It is not discussed her very often only because it is an unspoken truth about network programming. Do not speak further of this fact now that you know. The consequences could be dire.

  9. #9
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    DNS is used to negotiate where a domain should end up connecting to my friend. A domain by itself is utterly arbitrary.

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    That is how you should create it, but maybe I am misunderstanding your question. Are you not asking "given x domain, how do I know y IP?"

  11. #11
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You know... if you would spend more time trying the code out and seeing on your own than asking you would feel like a more accomplished programmer. Yes that will work.

  12. #12
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I feel so.... dirty... Just kidding. I don't mind helping.

  13. #13
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    freopen() perhaps?

  14. #14
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    There are some semi-dirty tricks to doing what you are asking. However, like all dirty tricks they are OS specific. I don't think you need any dirty tricks to simply get wget to rename an output file, however.

  15. #15
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Looks good to me Bravo, my friend. I am glad you got it working ok.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 06:38 PM
  2. Reading HTML files and Images from Website
    By Fade_to_Blah in forum C Programming
    Replies: 5
    Last Post: 07-08-2005, 08:49 AM
  3. File Reading..
    By NightWalker in forum C++ Programming
    Replies: 2
    Last Post: 05-07-2004, 04:47 AM
  4. question about reading in strings from a file :>
    By bball887 in forum C Programming
    Replies: 8
    Last Post: 04-13-2004, 06:24 PM
  5. question about reading files in
    By smd in forum C++ Programming
    Replies: 11
    Last Post: 08-25-2003, 07:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21