我试图发送这些数据:
GET /sms/send?number=4793224070&message=hei HTTP/1.1
Authorization: Basic bmV0Y89tOm3ldJNvbXh5eg==
User-Agent: Java1.3.1_01
Host: localhost:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
通过c#作为http get请求。我在一天内阅读了学习c#并了解了一下c#但我似乎无法弄清楚这一点。我已经走到了这一步:
WebRequest request = WebRequest.Create("http://firebolt.netcom.no:8080/sms/send");
答案 0 :(得分:0)
获取数据包含在网址内发布数据包含在您的请求中。
这就是我通常使用的:
WebClient client = new WebClient();
//Get request
// | GET DATA |
string response = client.DownloadString("http://firebolt.netcom.no:8080/sms/send?number=4793224070&message=hei");
//Post request
NameValueCollection nvc = new NameValueCollection(); //Stores post data
nvc.Add("number", "4793224070"); //value 1
nvc.Add("message", "hei"); //value 2
byte [] tmp = client.UploadValues("http://url.com/", nvc); //request
response = Encoding.UTF8.GetString(tmp);