Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-16-2013, 03:17 AM   #1
Beta Member
 
Join Date: Jul 2013
Location: United States
Posts: 2
Default Getting information from a website C++

Can someone please tell me how could one write a code in c++ that will go to a website gather information from it and create an array? Any libraries that could be used?

Thank you
__________________

dasith21 is offline   Reply With Quote
Old 07-16-2013, 07:10 PM   #2
Wizard of Wires
 
setishock's Avatar
 
Join Date: Feb 2005
Location: Not sure
Posts: 10,030
Default Re: Getting information from a website C++

What info are you after?
__________________

setishock is offline   Reply With Quote
Old 07-17-2013, 12:36 AM   #3
Beta Member
 
Join Date: Jul 2013
Location: United States
Posts: 2
Default Re: Getting information from a website C++

Quote:
Originally Posted by setishock View Post
What info are you after?
I want to read some stuff out of a financial report.
dasith21 is offline   Reply With Quote
Old 07-17-2013, 09:04 AM   #4
Site Team
 
celegorm's Avatar
 
Join Date: Sep 2006
Posts: 10,713
Send a message via AIM to celegorm
Default Re: Getting information from a website C++

Does the site publish some kind of feed or API?

Depending on the site you're connecting to you'll need to open some kind of network or socket communication pointing to the URL (and maybe port number) of the info you're trying to get at. If the site doesn't publish a URL or API to assist programmers in getting this into your program you'll want to find a different site.
__________________
"as a fanboy i refuse to admit it and will pull countless things out of my butt to disprove it"

Team Thelegorm! Total Kills: 21 (i iz in uor profile, editsing your sigz)
celegorm is offline   Reply With Quote
Old 07-18-2013, 08:08 AM   #5
Baseband Member
 
Join Date: Apr 2012
Location: UK
Posts: 78
Default Re: Getting information from a website C++

If it is HTML, I guess you could try making the program download the html file and then search for the info you need and display it, however I am not really sure how you would go about doing that.
__________________
CPU - AMD Athlon II X3 450, MB - Asus M5A78L-M LX, GPU - EVGA GTX 660 Ti, RAM - 8GB Ballistix 1333Mhz, PSU - 600W OCZ Modxstream-Pro
ParalizedTime is offline   Reply With Quote
Old 07-29-2013, 07:07 AM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: Getting information from a website C++

to be honest...

starting from the beginning and doing this in C++ will be a pain...

What you'll be doing is writing a script
connect to page, get data, process data, record data.

so use a scripting language!

PHP is good for this as there is a build in method for opening a web page as if it were a regular file, so you just open a web address and read the raw HTML as if it were text from a file. the code style and syntax is very close to C so you should be comfortable.
and there are again built in and easy methods for storing data, either to text files, posted to a different website, or pushed into a database, or emailed to you.

if you go the C route you'll need to create a network interface, then make sure if opens the correct port, then you'll need to work on your OSI layer seven code, to make sure it asks for an accepts HTML in a proper and standard way. then yu;re going to need to work with database connectors etc.

I disagree with the idea that if there is not an API that you should just find a different site, ideally, yes an API is grand.
but when you're talking about downloading and transforming plain text or XML from a site, it's not a huge bother to use search and trim commands to filter out the bulk of the HTML that's useless to your program leaving you only with the text data that you want.

additionally, if there is no API it's going to be a lot easier to change a plain text script in the future than it will be to get the code from a program, and recompile.
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



All times are GMT -5. The time now is 11:04 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0