Pelles C forum

C language => Expert questions => Topic started by: andre104 on July 24, 2010, 09:46:58 AM

Title: How to call web service in C
Post by: andre104 on July 24, 2010, 09:46:58 AM
I want to make a command line to update my Twitter status.
Here's the service provided by Twitter:
http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses%C2%A0update

I have done that in Java, but got no idea how to do that in C?
How to call the web service?
Title: Re: How to call web service in C
Post by: CommonTater on August 01, 2010, 04:59:42 AM
I want to make a command line to update my Twitter status.
Here's the service provided by Twitter:
http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses%C2%A0update

I have done that in Java, but got no idea how to do that in C?
How to call the web service?

If you're not doing anything other than calling up that webpage, the easiest thing you can do is to simply make a desktop shortcut.  (Open the page in your browser and drag the URL out onto the desktop).

To make a program to do this requires some knowledge of WinINet (see the SDK) and can be quite complex... Network programming is a real challenge.

If you are just wanting to launch the URL in your browser from inside a program it's much easier. 
In this latter case it's pretty simple...

Code: [Select]

#include <windows.h>

// get URL in string
strcpy(MyUrl,"Http:// ... ");

// add quotes if url has spaces
PathQuoteSpaces(MyURL);

// launch the window
ShellExecute(NULL,"Open",NULL,MyURL,NULL,SW_SHOWNORMAL);