Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
2.54/5 (4 votes)
See more:
I am going to integrate thetexting sms Api gateway , I have get the service url with parameters
[^]

and it send sms as well, Now i want to have a service which ask parameter just like that below reference
API URI: http://www.experttexting.com/exptapi/exptsms.asmx
and user would be able to set the values using textboxes instead of using url values using query string how to modify this service link which is mentioned above i am new to webservices.

below my code

What I have tried:

my code
<html>

<body>

<script>

    function onClick() {

        var apiKey = document.getElementById("api").value;
        var secret = document.getElementById("secret").value;
        var to = document.getElementById("to").value;
        var from = document.getElementById("from").value;
        var text = document.getElementById("text").value;

        var data = "api_secret=" +
                secret + // chane
                "&api_key=" +
                apiKey +  // change
              
                "&to=" +
                to + // change
                "&text=" +
                text + // change
                "&type=text";

        var xhr = new XMLHttpRequest();
        xhr.withCredentials = true;

        xhr.onreadystatechange = function () {
            if (this.readyState === 4 && this.status === 200) {
                alert("Message Sent");
                //                document.getElementById("api").value = "";
                //                document.getElementById("secret").value = "";
                document.getElementById("to").value = "";
                document.getElementById("from").value = "";
                document.getElementById("text").value = "";
            } else {
                //                alert("Message Failed");
                //                document.getElementById("api").value = "";
                //                document.getElementById("secret").value = "";
                document.getElementById("to").value = "";
                document.getElementById("from").value = "";
                document.getElementById("text").value = "";
            }
        };

   

        xhr.open("POST", "https://www.thetexting.com/rest/sms/json/message/send");
        xhr.setRequestHeader("cache-control", "no-cache");
        xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");

        xhr.send(data);
    }

</script>

<form method="get" action="http://www.goassadasogle.com">

    <table>
        <tr>
            <td>
                <label for="api">API key:</label>
            </td>
            <td>
                <input id="api" type="text" name="to"/>
            </td>


        <tr>

            <td>
                <label for="secret">Secret:</label>
            </td>

            <td>
                <input id="secret" type="text" name="to"/>

            </td>
        </tr>

        <tr>
            <td><label for="to">To:</label></td>
            <td><input id="to" type="text" name="to"/></td>
        </tr>
        <tr>
            <td><label for="from">From:</label></td>
            <td><input id="from" type="text" name="to"/> <br></td>
        </tr>
        <tr>
            <td><label for="text">text:</label></td>
            <td><textarea id="text" name="to" style="width: 300px; height: 200px"></textarea></td>
        </tr>

        </table>

    <input type="submit" value="click" onclick="onClick();"/>



</form>

</body>

</html>
Posted
Updated 20-Feb-19 17:45pm
v2
Comments
Richard Deeming 18-Feb-19 9:58am    
I don't know why this has come back into the "active" list, but I hope that's not your real API key and phone number that's been sitting in a public forum for over two years! :)

1 solution

You're not writing, nor even need, a web service app. This is just a normal web site, either ASP.NET or ASP.NET/MVC.

Once you get the data from the user, you can use the SMS API you linked to to send the message. Apparently, all you have to do is build the query string like you did in your test or however the documentation on the API you're using specifies.
 
Share this answer
 
Comments
Malikdanish 2-Feb-17 13:35pm    
Dear check the above code pls

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900