![CAI Networks WebControl PLC User Manual Download Page 46](http://html1.mh-extra.com/html/cai-networks/webcontrol-plc/webcontrol-plc_user-manual_3323111046.webp)
WebControl
TM
PLC User Guide Version 3.02.17f
Copyright(c) 2008,-2013 CAI Networks, Inc. 43
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char *data, *remote_mac, *remote_host;
long m,n;
FILE *fp;
char buffer[18] = "\r\nnew get call\r\n";
printf("%s%c%c\n",
"Content-Type:text/plain;charset=iso-8859-1",13,10);
data = getenv("QUERY_STRING");
remote_mac = getenv("HTTP_USER_AGENT");
remote_host = getenv("REMOTE_ADDR");
fp = fopen("/tmp/webcontrol.txt", "w+");
fwrite(buffer, 1, strlen(buffer), fp);
if(data != NULL) {
fwrite(data, 1, (unsigned int) strlen(data), fp);
fwrite(buffer, 1, strlen(buffer), fp);
}
if(remote_host != NULL) {
fwrite(remote_host, 1, (unsigned int) strlen(remote_host), fp);
fwrite(buffer, 1, strlen(buffer), fp);
}
if(remote_mac != NULL) {
fwrite(remote_mac, 1, (unsigned int) strlen(remote_mac), fp);
fwrite(buffer, 1, strlen(buffer), fp);
} else
fwrite(buffer, 1, strlen(buffer), fp);
/***************************************************
put your logic here if MAC address not match then do what
You can simply return with an error message
****************************************************/
/****************************************************
Now, you can process the data string send in by WebControl
****************************************************/