我正在尝试实施Message API
我不确定如何从代码隐藏中调用它,并在其代码片段中说:
https://platform.3cinteractive.com/api/send_message.php
POST
username=aRDSe3vcaMzh06YrMcxcQw==&password=1BSvQc6lpNlnp4ufWgRLPHNJ7RMrL8CcaWCzL1Vtw+Y=&phone_number=+11234567890&trigger_id=1105&message=howdy
答案 0 :(得分:11)
使用下面的WebRequest课程或使用RestSharp等库来获得更多控制权或您的HTTP请求:
// Create a request for the URL.
WebRequest request = WebRequest.Create ("http://www.contoso.com/default.html");
// If required by the server, set the credentials.
request.Credentials = CredentialCache.DefaultCredentials;
// Get the response.
HttpWebResponse response = (HttpWebResponse)request.GetResponse ();
// Display the status.
Console.WriteLine (response.StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Cleanup the streams and the response.
reader.Close ();
dataStream.Close ();
response.Close ();
答案 1 :(得分:1)
您需要使用WebRequest并执行HTTP POST。请参阅此文章,标题为How to: Send Data Using the WebRequest Class。