User Tools

Site Tools


chiamata_asp

Chiamata ASP

Esempio API

    <%
     
    function SendSMS(username,password,recipients,text,charset)
    url = "https://www.smskdev.it/send.php"
     
    parameters ="username=" & Server.urlencode(username) & "&" _
    & "password=" & Server.urlencode(password) & "&" _
    & "text=" & Server.urlencode(text) & "&" _
    & "to=" & join(recipients,"&recipients[]=")
     
     
     
    if sender_number <> "" then parameters = parameters & "&sender_number=" & Server.urlencode(sender_number)
    if sender_string <> "" then parameters = parameters & "&sender_string=" & Server.urlencode(sender_string)
     
    select case charset
    case "UTF-8"
    parameters = parameters & "&charset=" & Server.urlencode("UTF-8")
    case else
    end select
     
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "POST", url, false
    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlhttp.setRequestHeader "Content-Length", Len(parameters)
    xmlhttp.Send parameters
     
    If xmlhttp.Status >= 400 And xmlhttp.Status <= 599 Then
    SendSMS = "status=failed&message=" & xmlhttp.Status & " - " & xmlhttp.statusText
    exit function
    End If
     
    msg = xmlhttp.responseText
    set xmlhttp = nothing
     
    SendSMS = msg
    end function
     
    Dim recipients
    Dim i
     
    ' Invio di un singolo SMS
    recipients = array("39XXXXXXXXXX")
     
    ' Per invio multiplo del testo a 2 o più destinatari
    ' recipients = array("39XXXXXXXXXX","39XXXXXXXXX1")
     
     
     
    ' Invio SMS
    result = SendSMS("username","password",recipients,"Test invio SMS","")
     
    responses = split(result,"&")
     
    for each item in responses
    Response.write item & "<br/>"
    next
     
    %>
chiamata_asp.txt · Last modified: 2023/12/29 14:29 (external edit)