C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28651
Number of posts: 94667

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How do you connect a program to the internet/website? Posted by AlecC on 17 May 2011 at 9:00 AM
Hey, so recently in my school our teacher wanted us to spend the next 2-3 weeks making up a program of our own choice. (We learned Java in class but I wanted to try something different and learn C++.) Anyway I'm a beginner at C++ and I was wondering how exactly do programs connect to websites/the internet because I wanted to make a program that would notify me of any updates/changes on a website (such as a blog, forum, etc) and provide and archive of it. What I'm really having trouble with is I have no idea how a program connects to the internet in the first place. Could anyone show me somewhere that I could learn this?
Report
Re: How do you connect a program to the internet/website? Posted by Malcolm_McLean on 25 May 2011 at 7:02 AM
Try here. It's a nice tutorial on sockets programming.
Read my books
MiniBasic how to write a script interpreter
Basic Algorithms (in C)
Report
Re: How do you connect a program to the internet/website? Posted by mallory123 on 16 Jun 2011 at 10:34 AM
# Connect to a site example
# #include<windows.h>
# #include<wininet.h>
# #include<stdio.h>
# int main()
# {
#
# HINTERNET Initialize,Connection,File;
# DWORD dwBytes;
# char ch;
# Connection = InternetConnect(Initialize,"www.xxx.com",INTERNET_DEFAULT_HTTP_PORT,
# NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
#
# File = HttpOpenRequest(Connection,NULL,"/index.html",NULL,NULL,NULL,0,0);

if(HttpSendRequest(File,NULL,0,NULL,0))
{
while(InternetReadFile(File,&ch,1,&dwBytes))
{
if(dwBytes != 1)break;
putchar(ch);
}
}
InternetCloseHandle(File);
InternetCloseHandle(Connection);
InternetCloseHandle(Initialize);
return 0;
}
</stdio.h></wininet.h></windows.h>

Web Solution India




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.