This can be used instead of the username/hash/password. Your secure hash can be found within Messenger in the main navigation under “ Help->All Documentation“.Īlternatively you can use the password parameter instead and use your Textlocal password in plain text. The email address used to log into Textlocal. The message also must be URL Encoded to support symbols like &. See Helpful Information for message length details. This parameter should be no longer than 918 characters. This must be at least 3 characters in length but no longer than 11 alphanumeric characters or 13 numeric characters. Use this field to specify the sender name for your message. Return CType(response, HttpWebResponse).StatusDescription Request.ContentType = "application/x-0, byteArray.Length)ĭim response As WebResponse = request.GetResponse()ĭataStream = response.GetResponseStream()ĭim reader As New StreamReader(dataStream)ĭim responseFromServer As String = reader.ReadToEnd() + "&message=" + WebUtility.UrlEncode(message) _ĭim request As WebRequest = WebRequest.Create(strPost)ĭim byteArray As Byte() = (strPost) URLConnection conn = url.openConnection() īufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())) String data = "" + apiKey + numbers + message + sender String sender = "&sender=" + URLEncoder.encode("Jims Autos", "UTF-8") String message = "&message=" + URLEncoder.encode("This is your message", "UTF-8") String apiKey = "apikey=" + URLEncoder.encode("yourapiKey", "UTF-8") String data = apiKey + numbers + message + sender Ĭonn.setRequestProperty("Content-Length", Integer.toString(data.length())) Ĭonn.getOutputStream().write(data.getBytes("UTF-8")) įinal BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())) įinal StringBuffer stringBuffer = new StringBuffer() HttpURLConnection conn = (HttpURLConnection) new URL("").openConnection() String sender = "&sender=" + "Jims Autos" String message = "&message=" + "This is your message" String apiKey = "apikey=" + "yourapiKey" Raise Exception.Create('Unable to initialize Wininet') UrlHandle := InternetOpenUrl(NetHandle, PChar(Url), nil, 0, INTERNET_FLAG_RELOAD, 0) NetHandle := InternetOpen('Delphi 5.x', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) Using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))įunction getURLContent(const Url: string): string HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse() MyWriter = new StreamWriter(objRequest.GetRequestStream()) ObjRequest.ContentType = "application/x-www-form-urlencoded" HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url) refer to parameters to complete correct url string String url = "" + apiKey + "&numbers=" + numbers + "&message=" + message + "&sender=" + sender String numbers = "447123456789" // in a comma seperated list Status: " & wex.Status & "Message: " & wex.Message & "") Req.ContentType = "application/x-sr As New StreamReader(resp.GetResponseStream()) If you want to validate your key without actually using your text quota, append " _test" to your key and you will receive a response from the /text endpoint confirming that a text would send, but it will not consume your credits.Ĭreate an API key to start sending and receiving SMS.Sub Page_Load(sender As Object, e As EventArgs)ĭim Message As String = "This is an API message"ĭim PostData As String = "apikey=" & apikey & "&sender=" & SenderName & "&numbers=" & Number & "&message=" & Messageĭim req As HttpWebRequest = WebRequest.Create(URL)ĭim byte1 As Byte() = encoding.GetBytes(PostData) Here's an example success response after sending an SMS: The best way to get started is to try it yourself, or view the documentation here. For a reliable, zero-setup solution that works with mobile networks, create an API key.For a free, self-hosted server that relies on email gateways, head over to the open source project.Textbelt offers open-source and paid versions: Create your own key to send more messages afterwards. Try it now: use key=textbelt to send 1 free text per day.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |