Thread: C++ Web Functions?

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    12

    C++ Web Functions?

    This is a really beginner question I'm assuming, but does C++ have capabilities of doing things like....I guess I'll give an example.

    Example:

    Program goes online, logs into an account, and accepts multiple friend requests. Then, goes into the inbox, clicks reply and gives an automated response. Then clicks send.



    Can it do things like that?

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Quote Originally Posted by Code Thug View Post
    Can it do things like that?
    I would say a programmer could do things like that using C++ or any other language...
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    12
    Thanks, please post if you know any beginner tutorials regarding this.


    I do know C++ basics.

  4. #4
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    The specific site you want to go to depends on what you use for development, but the general idea is to use TCP/IP sockets.

    Here are a few, it looks like they're all geared towards windows development but the third is deliberately portable:
    Tutorial: Using the C++ Sockets library
    An introduction to Windows socket/Winsock 2/Windows user side programming tutorial
    Simple, Portable, Socket Tutorial in C

    EDIT: As for actually connecting and sending requests to a website, you'll have to look elsewhere - that (obviously) is site-specific.
    Last edited by bernt; 04-11-2010 at 12:43 PM.
    Consider this post signed

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    12
    Thanks, but isn't there a way to do this with GetElementByID()?


    Pardon me if that's for something completely different.

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    12
    This may sound utterly stupid, but isn't there a way I can create a program that will, basically, do everything I would normally do to do all of those things?

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336

  8. #8
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    Posts
    426
    Thanks, but isn't there a way to do this with GetElementByID()?
    If there is a GetElementByID() for C/C++, I wasn't aware of it. I'm pretty sure that's only in the "web-scripting" languages (read: javascript, VBscript, C#). Web programming definitely isn't my forte however. I could be wrong.

    You might also consider scrapping the C/C++ for a project like this and using the Greasemonkey Firefox addon instead.
    Consider this post signed

  9. #9
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Or you could look for some libraries that do the HTTP input/output and HTML parsing for you. Because without that, it is near impossible to do...

    But otherwise, a firefox extension is better.

  10. #10
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    Something like libcurl plus an xml parser would be useful.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  11. #11
    Registered User
    Join Date
    Feb 2010
    Posts
    12
    Quote Originally Posted by bernt View Post
    If there is a GetElementByID() for C/C++, I wasn't aware of it. I'm pretty sure that's only in the "web-scripting" languages (read: javascript, VBscript, C#). Web programming definitely isn't my forte however. I could be wrong.

    You might also consider scrapping the C/C++ for a project like this and using the Greasemonkey Firefox addon instead.
    Actually I'm coding this as part of an AI. I think tabstop's link should work.

  12. #12
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    You CANNOT do client side browser programming in C/C++. Your only option there is javascript.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  13. #13
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    However, you probably don't need to do this in the browser at all. All those clicks, etc, are either synchronous GET/POST requests, which you can spoof via HTTP, or they are asynchronous AJAX style requests, which you *may* also be able to spoof but that is going to be a relatively complex task, in terms of understanding the technology involved. This can be done in C/C++, altho it would not be my first choice.

    You need to examine the page source for the site you are interested in and work from there, although from the sounds of things you are going to have to learn some basic things about web-dev first.
    Last edited by MK27; 04-11-2010 at 01:42 PM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 11-17-2008, 01:00 PM
  2. Static functions.... why?
    By patricio2626 in forum C++ Programming
    Replies: 4
    Last Post: 04-02-2007, 08:06 PM
  3. Static member functions more efficient?
    By drrngrvy in forum C++ Programming
    Replies: 6
    Last Post: 06-16-2006, 07:07 AM
  4. Void Functions Help
    By bethanne41 in forum C++ Programming
    Replies: 1
    Last Post: 05-09-2005, 05:30 PM
  5. Variables do not equal functions!!!
    By me@burk. in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 06:24 AM