>>用socket如何编写下列http://211.100.115.37/lxd/liuyue.php?>>username=try2&password=060621&birth=19530528&length=70的HTTP协议的POST方法
>>==============================
你这个是GET方法的吧?>>用户名是:try2
>>密码是:060621
================================================
如果是集成身份认证的话
这个必须得对身份验证信息加密,然后作为一个 Authration头提交过去
string pp="POST http://211.100.115.37/lxd/liuyue.php HTTP/1.1\r\n
Content-Length:54\r\n
Content-Type:application/x-www-form-urlencoded\r\n
Cache-Control:no-cache\r\n
\r\n
username=try2&password=060621&birth=19530528&length=70\r\n";

解决方案 »

  1.   

    POST /lxd/liuyue.php HTTP/1.1 
    Accept: */*
    Accept-Language: zh-cn
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; .NET CLR 1.1.4322; Alexa Toolbar
    Host: 211.100.115.37
    Connection: Keep-Aliveusername=try2&password=060621&birth=19530528&length=70
      

  2.   

    使用HttpClient,比较方便的操作socket
      

  3.   

    用户名和密码直接写到实体中就可以吗,像这样username=try2&password=060621&birth=19530528&length=70,如果要用Authration,应该怎么样,是否还要加密?
    我用了上述二位的格式,提示我这里有一个错误
    [wangzhh@test test]$ ./test
    POST http://211.90.115.37/lxd/liuyue.php HTTP/1.0
    Content_Length:54
    Content-Type:application/x-www-form-urlencoded
    Cache-Control:no-cacheusername=try2&password=060621&birth=19530528&length=70
    HTTP/1.1 200 OK
    Date: Mon, 26 Jun 2006 03:36:56 GMT
    Server: Apache/2.0.40 (Red Hat Linux)
    Accept-Ranges: bytes
    X-Powered-By: PHP/4.2.2
    Content-Length: 73
    Connection: close
    Content-Type: text/html; charset=gb2312<?xml version="1.0" encoding="gb2312"?>
    <main>
            <errno>1</errno>
    </main>我如果使用HTTP/1.1 就会有下列错误
    HTTP/1.1 400 Bad Request
    Date: Mon, 26 Jun 2006 03:42:45 GMT
    Server: Apache/2.0.40 (Red Hat Linux)
    Content-Length: 298
    Connection: close
    Content-Type: text/html; charset=iso-8859-1<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html><head>
    <title>400 Bad Request</title>
    </head><body>
    <h1>Bad Request</h1>
    <p>Your browser sent a request that this server could not understand.<br />
    </p>
    <hr />
    <address>Apache/2.0.40 Server at 211.100.115.37 Port 80</address>
    </body></html>
      

  4.   

    >>我如果使用HTTP/1.1 就会有下列错误可能是服务器不支持 HTTP/1.1
      

  5.   

    怎么样使用Authorization头写用户名和密码呀
      

  6.   

    用GET方法可以实现,谢谢各位了