GET 方式:
?sck->write("GET /weidian/kfxt.php?msg=abcdef\r\n\r\n");
或:
http_get_msg("abcdef")
void http::http_get_msg(char *page)
{
memset(get_msg_buf,0,1000);
strcat(get_msg_buf,"GET ");
strcat(get_msg_buf,page);
strcat(get_msg_buf," HTTP/1.1\r\n");
strcat(get_msg_buf,"Host: www.baidu.com\r\n\r\n");
sck->write(get_msg_buf,strlen(get_msg_buf));
}
?POST 方式:
post_msg("/post.php","msg=gg");
void post_msg(char*page,char*data)
{
charbuf[1000];
memset(buf,0,1000);
sprintf(buf,"POST");
sprintf(buf+strlen(buf),page);
sprintf(buf+strlen(buf),"HTTP/1.0\r\n");
sprintf(buf+strlen(buf),"Content-Type:application/x-www-form-urlencoded\r\n");
sprintf(buf+strlen(buf),"Accept:*/*\r\n");
sprintf(buf+strlen(buf),"Content-Length:");
sprintf(buf+strlen(buf),"%d",strlen(data));
sprintf(buf+strlen(buf),"\r\n\r\n");
sprintf(buf+strlen(buf),data);
sck->write(buf,strlen(buf));
}