send data internet using C
I need to send a signal via my remote PC to the Internet that let me know if this pc is connected. I could send a link with GET values to my page and then from that php page make a query to the database. How do I send this value through a C program that ru开发者_运维百科ns on this remote PC? thanks!
(it's a windows pc)
For making HTTP requests I recommend libcurl, which is the library that almost everybody seems to be using.
http://curl.haxx.se/libcurl/
What operating system? Linux? Windows? Does the program need to be cross-platform? The reason I ask is that it influences whether you should use a library, or TCP/IP sockets, given that the request will be very simple.
Also, why not use Perl, or better yet, wget? You could schedule a task in windows, or a cronjob in unix, to wget http://yoururl/path?pcname=`uname`
or similar..
What about using a client like dyndns? I'm not sure using a C program would be such a good idea for that purpose; it's a system administration task and using scripting for this would work best, unless you have a specific need in mind.
精彩评论