GBK緙栫爜鍙戦佹帴鍙e湴鍧錛?br />
http://gbk.sms.webchinese.cn/?Uid=鏈珯鐢ㄦ埛鍚?amp;Key=鎺ュ彛瀹夊叏瀵嗙爜&smsMob=鎵嬫満鍙風爜&smsText=鐭俊鍐呭
UTF-8緙栫爜鍙戦佹帴鍙e湴鍧錛?/strong>
http://utf8.sms.webchinese.cn/?Uid=鏈珯鐢ㄦ埛鍚?amp;Key=鎺ュ彛瀹夊叏瀵嗙爜&smsMob=鎵嬫満鍙風爜&smsText=鐭俊鍐呭
鑾峰彇鐭俊鏁伴噺鎺ュ彛鍦板潃(UTF8)錛?/strong>
http://sms.webchinese.cn/web_api/SMS/?Action=SMS_Num&Uid=鏈珯鐢ㄦ埛鍚?amp;Key=鎺ュ彛瀹夊叏瀵嗙爜
鑾峰彇鐭俊鏁伴噺鎺ュ彛鍦板潃(GBK)錛?/strong>
http://sms.webchinese.cn/web_api/SMS/GBK/?Action=SMS_Num&Uid=鏈珯鐢ㄦ埛鍚?amp;Key=鎺ュ彛瀹夊叏瀵嗙爜
鎻愮ず:HTTP璋冪敤URL鎺ュ彛鏃? 鍙傛暟鍊煎繀欏籙RL緙栫爜鍚庡啀璋冪敤
鍙傛暟鍙橀噺 | 璇存槑 |
Gbk緙栫爜Url |
http://gbk.sms.webchinese.cn/ |
Utf-8緙栫爜Url |
http://utf8.sms.webchinese.cn/ |
Uid |
鏈珯鐢ㄦ埛鍚嶏紙濡傛偍鏃犳湰绔欑敤鎴峰悕璇峰厛娉ㄥ唽錛?/td>
|
Key |
娉ㄥ唽鏃跺~鍐欑殑鎺ュ彛瀹夊叏瀵嗙爜錛堝彲鍒扮敤鎴峰鉤鍙頒慨鏀瑰畨鍏ㄥ瘑鐮侊級 |
smsMob |
鐩殑鎵嬫満鍙風爜錛堝涓墜鏈哄彿璇風敤鍗婅閫楀彿闅斿紑錛?/td>
|
smsText |
鐭俊鍐呭錛屾渶澶氭敮鎸?00涓瓧錛屾櫘閫氱煭淇?0涓瓧/鏉★紝闀跨煭淇?4涓瓧/鏉¤璐?/td>
|
澶氫釜鎵嬫満鍙瘋鐢ㄥ崐瑙?闅斿紑
濡傦細13888888886,13888888887,1388888888 涓嬈℃渶澶氬50涓墜鏈哄彂閫?br />
鐭俊鍐呭鏀寔闀跨煭淇★紝鏈澶?00涓瓧錛屾櫘閫氱煭淇?0涓瓧/鏉★紝闀跨煭淇?4涓瓧/鏉¤璐?/p>
鐭俊鍙戦佸悗榪斿洖鍊?/th> | 璇淬鏄?/th>
|
-1 |
娌℃湁璇ョ敤鎴瘋處鎴?/td>
|
-2 |
瀵嗛挜涓嶆紜紙涓嶆槸鐢ㄦ埛瀵嗙爜錛?/td>
|
-3 |
鐭俊鏁伴噺涓嶈凍 |
-11 |
璇ョ敤鎴瘋紱佺敤 |
-14 |
鐭俊鍐呭鍑虹幇闈炴硶瀛楃 |
-4 |
鎵嬫満鍙鋒牸寮忎笉姝g‘ |
-41 |
鎵嬫満鍙風爜涓虹┖ |
-42 |
鐭俊鍐呭涓虹┖ |
澶т簬0 |
鐭俊鍙戦佹暟閲?/td>
|
|
銆銆 娉細璋冪敤API鎺ュ彛錛岃鐧誨綍騫沖彴錛岀敵璇?06緗戝叧鍙戦侊紝鍗沖彂鍗沖埌錛?br />
銆銆鍙戦佹祴璇曠煭淇¤鍕胯緭鍏ワ細鐭俊嫻嬭瘯絳夎瘝璇紝璇風洿鎺ユ彁浜ゆ偍瑕佸彂閫佺殑鐭俊鍐呭錛?br />
銆銆鎺ュ彛鍙戦佺煭淇℃椂璇峰湪鍐呭鍚庡姞絳懼悕錛氥怷X鍏徃鎴朮X緗戝悕縐般戯紝鍚﹁呬細琚?/strong>灞忚斀銆?br />
銆銆鐭俊絳懼悕鍙湪鐢ㄦ埛騫沖彴騫沖彴涓婅緗紝涔熷彲浠ュ湪鐭俊鍐呭鍚庯紝鐩存帴鍔犲叆銆?/strong> |
|
1. ASP 璋冪敤渚嬪瓙
<%
'甯哥敤鍑芥暟
'杈撳叆url鐩爣緗戦〉鍦板潃錛岃繑鍥炲糶etHTTPPage鏄洰鏍囩綉欏電殑html浠g爜
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
'鑷凡緇勫悎涓涓嬫彁浜ょ殑URL鍔犲叆鑷繁鐨勮處鍙峰拰瀵嗙爜
sms_url="http://sms.webchinese.cn/web_api/?Uid=璐﹀彿&Key=鎺ュ彛瀵嗛挜&smsMob=鎵嬫満鍙風爜&smsText=鐭俊鍐呭"
response.write getHTTPPage(sms_url)
%>
|
2.C# 璋冪敤
//闇瑕佺敤鍒扮殑鍛藉悕絀洪棿
using System.Net;
using System.IO;
using System.Text;
//璋冪敤鏃跺彧闇瑕佹妸鎷兼垚鐨刄RL浼犵粰璇ュ嚱鏁板嵆鍙傚垽鏂繑鍥炲煎嵆鍙?br />
public string GetHtmlFromUrl(string url)
{
string strRet = null;
if(url==null || url.Trim().ToString()=="")
{
return strRet;
}
string targeturl = url.Trim().ToString();
try
{
HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(targeturl);
hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
hr.Method = "GET";
hr.Timeout = 30 * 60 * 1000;
WebResponse hs = hr.GetResponse();
Stream sr = hs.GetResponseStream();
StreamReader ser = new StreamReader(sr, Encoding.Default);
strRet = ser.ReadToEnd();
}
catch (Exception ex)
{
strRet = null;
}
return strRet;
}
|
3.JAVA璋冪敤
import java.io.UnsupportedEncodingException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.PostMethod;
public class SendMsg_webchinese {
public static void main(String[] args)throws Exception
{
HttpClient client = new HttpClient();
PostMethod post = new PostMethod("http://gbk.sms.webchinese.cn");
post.addRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=gbk");//鍦ㄥご鏂囦歡涓緗漿鐮?br />
NameValuePair[] data ={ new NameValuePair("Uid", "鏈珯鐢ㄦ埛鍚?),new NameValuePair("Key", "鎺ュ彛瀹夊叏瀵嗙爜"),new NameValuePair("smsMob","鎵嬫満鍙風爜"),new NameValuePair("smsText","鐭俊鍐呭")};
post.setRequestBody(data);
client.executeMethod(post);
Header[] headers = post.getResponseHeaders();
int statusCode = post.getStatusCode();
System.out.println("statusCode:"+statusCode);
for(Header h : headers)
{
System.out.println(h.toString());
}
String result = new String(post.getResponseBodyAsString().getBytes("gbk"));
System.out.println(result);
post.releaseConnection();
}
}
jar鍖呬笅杞?/strong>
commons-logging-1.1.1.jar
commons-httpclient-3.1.jar
commons-codec-1.4.jar
|
4.PHP
$url='http://sms.webchinese.cn/web_api/?Uid=璐﹀彿&Key=鎺ュ彛瀵嗛挜&smsMob=鎵嬫満鍙風爜&smsText=鐭俊鍐呭';
echo Get($url);
function Get($url)
{
if(function_exists('file_get_contents'))
{
$file_contents = file_get_contents($url);
}
else
{
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
}
return $file_contents;
}
|
5.VB.NET
'璋冪敤鍙戦佺煭淇?NoList鎺ユ敹鍙風爜.澶氫釜涔嬮棿鐢?鍒嗗紑,Memo鍐呭70瀛?br />
Public Function SendSMS(ByVal NoList As String, ByVal Memo As String) As String
Dim Url As String = "http://sms.webchinese.cn/web_api/?Uid=璐﹀彿&Key=鎺ュ彛瀵嗛挜&smsMob=鎵嬫満鍙風爜&smsText=鐭俊鍐呭"
Dim webClient As New Net.WebClient()
Try
'Dim responseData As Byte() =
Dim srcString As String = webClient.DownloadString(Url)
Return srcString
Catch
Return "-444"
End Try
End Function |