Above is a simple code I am creating a socket which binds to the server X above.
After that I want to send some messages Y to the server to get the desired options/options information. X refers to server which I can to connect to and Y refers to the query/message i am sending to X.

However, I got no knowledge in web protocol and got no idea what to put in X and Y.

Most services like this use HTTP. Instead of implementing your own HTTP client you might want to use a pre-existing library like libCURL. Yahoo's finance API docs are here: developer.yahoo.com/finance
–
craig65535Nov 1 '12 at 18:59

1 Answer
1

You better use a library like libcurl. Which will relieve you from all the hard work of socket programming. Using curl you can create HTTP requests, send them and receive responses. It is very easy to use. Here are some example programs. Learn about Yahoo APIs here.

My only problem now is only to get the Options Price of a Stock, not the Stock Price. I still dont know which server to connect to and which querry should I use to retrieve them. For stock price, for example. I used host = gethostbyname("download.finance.yahoo.com"); connect(Socket,(SOCKADDR*)(&SockAddr),sizeof(SockAddr)); send(Socket,"GET /d/quotes.csv?s=aa&f=nsl1mx HTTP/1.0\n\n", strlen( "GET /d/quotes.csv?s=aa&f=nsl1mx HTTP/1.0\n\n" ),0); It would be helpful if you know the server name and querry I can use with the above format to get the options data for a stock.
–
user1792283Nov 1 '12 at 20:34