POST don';不起作用

本文关键字:不起作用 don POST | 更新日期: 2023-09-27 18:25:44

all!我有这样的php页面:

    <?php 
 if(isset($_POST['userid']) and  isset($_POST['dlspeed']) )
 {
  $userid=$_POST['userid'];
  $dlspeed=$_POST['dlspeed'];
  $timestamp =date("y-m-d H:i");
  $db_conn = mysql_connect('localhost', "root", "asdk78623r");
  mysql_select_db("speedtest", $db_conn);
  $query='INSERT INTO status VALUE (NULL, "'.$userid.'", "'.$dlspeed.'", "'.$timestamp.'")';
  $result=mysql_query($query,$db_conn);
 }
?

从C#我做的帖子:

      HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(pageurl);
                byte[] buffer = Encoding.ASCII.GetBytes(data);
                System.Net.ServicePointManager.Expect100Continue = false;
                WebReq.SendChunked = false;
                WebReq.Expect = null;
                WebReq.KeepAlive = false;
                //I try also setting proxy
                // WebReq.Proxy = new WebProxy("192.168.0.107", 3128);
                //Our method is post, otherwise the buffer (postvars) would be useless
                WebReq.Method = "POST";
                //We use form contentType, for the postvars.
                WebReq.ContentType = "application/x-www-form-urlencoded";
                //The length of the buffer (postvars) is used as contentlength.
                WebReq.ContentLength = buffer.Length;
                //We open a stream for writing the postvars
                Stream PostData = WebReq.GetRequestStream();
                //Now we write, and afterwards, we close. Closing is always important!
                PostData.Write(buffer, 0, buffer.Length);
                PostData.Close();
              //posted data is not inserted in db
//and in follow line code Ive got error: The remote server returned an error: (417)  //Expectation failed
                HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();  

我做错了什么?使用follow curl命令站工作正常:

curl -d "userid=SW783IC2QDHFYU6P4XKO&dlspeed=814,602968463903&timestamp=2012-2-23 19:29:33" pageurl

有什么想法、建议、重新考虑吗?

POST don';不起作用

发生这种情况的原因有多种选择。

http://www.checkupdown.com/status/E417.html

其中一个原因可能是:http://haacked.com/archive/2004/05/15/http-web-request-expect-100-continue.aspx

安装一个程序,记录你的请求和它们包含的内容(fiddler2工作得很好,免费且易于使用,有几个非常相似但记不起它们的名字atm)

试着看看你是否找到了不应该出现的标题,如果你一辈子都找不到,一旦你发布了,这里的人可能会帮助你。