A
abigfish
Unregistered / Unconfirmed
GUEST, unregistred user!
*/
public string Send(MMessage mm)
{
try
{
// 验证参数有效性
WebRequest wReq = WebRequest.Create(sMmscUrl);
HttpWebRequest hReq = (HttpWebRequest)wReq;
wReq.Headers.Clear();
if (sProxyUrl.Length > 0)
wReq.Proxy = new WebProxy(sProxyUrl);
wReq.ContentType = "application/vnd.wap.mms-message";
hReq.Accept = "application/vnd.wap.mms-message,text/plain,*/*";
wReq.Method = "POST";
hReq.KeepAlive = false;
hReq.UserAgent = "Nokia6681/2.0 (4.00.15) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1";
// Write Post Dat
byte[] byMM = mm.GetContent();
hReq.ContentLength = byMM.Length;
Stream sReq = wReq.GetRequestStream();
sReq.Write(byMM, 0, byMM.Length);
sReq.Close();
// Http Request
WebResponse wRes = wReq.GetResponse();
HttpWebResponse hRes = (HttpWebResponse)wRes;
if (hRes.StatusCode == HttpStatusCode.OK)
{
Stream sRes = wRes.GetResponseStream();
StreamReader sr = new StreamReader(sRes);
string szResult = sr.ReadToEnd(); // 发送结果
// Parse result sring
return szResult;
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
return string.Empty;
}
}
以上是从CSDN上找到的发彩信的一点代码,可是在DELPHI中,这个要怎么编呢?给点思路就有分了,如果全部改写上面的代码就再给100分了
public string Send(MMessage mm)
{
try
{
// 验证参数有效性
WebRequest wReq = WebRequest.Create(sMmscUrl);
HttpWebRequest hReq = (HttpWebRequest)wReq;
wReq.Headers.Clear();
if (sProxyUrl.Length > 0)
wReq.Proxy = new WebProxy(sProxyUrl);
wReq.ContentType = "application/vnd.wap.mms-message";
hReq.Accept = "application/vnd.wap.mms-message,text/plain,*/*";
wReq.Method = "POST";
hReq.KeepAlive = false;
hReq.UserAgent = "Nokia6681/2.0 (4.00.15) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1";
// Write Post Dat
byte[] byMM = mm.GetContent();
hReq.ContentLength = byMM.Length;
Stream sReq = wReq.GetRequestStream();
sReq.Write(byMM, 0, byMM.Length);
sReq.Close();
// Http Request
WebResponse wRes = wReq.GetResponse();
HttpWebResponse hRes = (HttpWebResponse)wRes;
if (hRes.StatusCode == HttpStatusCode.OK)
{
Stream sRes = wRes.GetResponseStream();
StreamReader sr = new StreamReader(sRes);
string szResult = sr.ReadToEnd(); // 发送结果
// Parse result sring
return szResult;
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
return string.Empty;
}
}
以上是从CSDN上找到的发彩信的一点代码,可是在DELPHI中,这个要怎么编呢?给点思路就有分了,如果全部改写上面的代码就再给100分了