int httpsqs_get(char *queuename) { int black_sock; black_sock = htconnect(HttpsqsIp, HttpsqsPort); if (black_sock < 0) return; htsend(black_sock, "GET /?charset=utf-8&name=%s&opt=get HTTP/1.1\r\n", queuename, 10); htsend(black_sock, "Host: %s\r\n", HttpsqsIp, 10); htsend(black_sock, "Connection: close\r\n", 10); htsend(black_sock, "\r\n", 10); return black_sock; }
int http_post(char *datastr) { int black_sock; int len = 0; black_sock = htconnect(RemoteIp, RemotePort); if (black_sock < 0) return; len = strlen(datastr) + 5; htsend(black_sock, "POST /index.php?m=feed&a=feed_add HTTP/1.1\r\n", 10); htsend(black_sock, "Content-type: application/x-www-form-urlencoded\r\n", 10); htsend(black_sock, "Host: www.oooffice.com\r\n", 10); htsend(black_sock, "Content-Length: %d\r\n", len, 10); htsend(black_sock, "Connection: close\r\n", 10); htsend(black_sock, "\r\n", 10); htsend(black_sock, "data=%s", datastr, 10); return black_sock; }
int SendUpdateCmd(int itemId,char *slots,char *cardtypes,char *filename){ int black_sock; char msg[1024]={0}; char request[1024] = {0}; char URL[1024] = {0}; char ipaddr[32]; sprintf(URL,"/cgi-bin/webadmin/requpdate.cgi"); char *Content = "application/x-www-form-urlencoded"; char conf[1024] = {0}; sprintf(conf,"slots=%s&cardtypes=%s&pkgName=%s",slots,cardtypes,filename); #ifdef RUN_ON_PC sprintf(ipaddr,"192.168.1.46"); #else webLog("---itemId=%d",itemId); //sprintf(ipaddr,"192.168.0.%d",itemId); char *lIpaddr = getDistInnerIp(itemId); webLog("---lIpaddr=%s",lIpaddr); if(lIpaddr != NULL){ sprintf(ipaddr,"%s",lIpaddr); }else{ webLog("getLocalIpError\n"); return 0; } #endif black_sock = htconnect(ipaddr,80); if(black_sock <1){ return 0; } sprintf(request, "POST %s HTTP/1.0\r\nAccept: */*\r\nContent-Length:%d\r\nContent-Type: %s\r\nAuthorization:Basic YWRtaW46YWRtaW4=\r\nCredentials:admin:admin\r\n\r\n%s",URL,strlen(conf),Content,conf); send(black_sock, request,sizeof(request),0); recv(black_sock,msg,sizeof(msg),0); webLog("return:%s",msg); close(black_sock); return 1; }