socket 转http post连接

来源:互联网 发布:淘宝店铺常用推广方式 编辑:程序博客网 时间:2024/04/30 13:02
socket 发生数据到http服务器需要增加一个http协议包头才可以正确解析!

类似于下在xml正确请求报文前面增加一个请求包头!

 sprintf(Request,
                "POST %s HTTP/1.0\r\n"
                "HOST: %s\r\n"
                "Content-Type: %s; charset=utf-8\r\n"
                "Content-Length: %d\r\n"
                "%s\r\n", 
                "http://10.133.7.29:18090/spayment/servlet/gfbank.portal.GFPortalTrade"
                , "10.133.7.29:18090" 
                , "application/xml; charset=utf-8" 
                ,xml.length());