Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4855
  • Last Modified:

Post HTTP Using VBScript

Hello,

I am trying to send an SMS using an HTTP Post method from a VBScript, but it doesn't work - I do get a 'SMS Sent' message so no error is being returned, however the SMS actually isn't sent - no credits are used up and no SMS is received... I'm sure it's something to do with my code though - I have tried both POST & GET and neither works:

  Set objSrvHTTP = CreateObject("Msxml2.ServerXMLHTTP.6.0")
   
   url = "https://api.clickatell.com/http/sendmsg?user=[UserID]&password=[password]&api_id=[API_ID]&to=[phone_number]&text=Test Message"
   objSrvHTTP.open "GET", url
   objSrvHTTP.send
   Set objXML = objSrvHTTP.responseXML
   
   If objXML.parseError.errorCode <> 0 Then
                WScript.ECHO "Error Found"
   Else
     WScript.ECHO "SMS Sent"
   End If
   
WScript.Quit

Open in new window


Thanks in advance
0
Nico2011
Asked:
Nico2011
  • 3
  • 2
2 Solutions
 
Robberbaron (robr)Commented:
shouldnt you be using POST method when sending data.

objSrvHTTP.open "POST", url
0
 
Nico2011Author Commented:
As I mentioned above - I tried both POST & GET - neither work
0
 
Robberbaron (robr)Commented:
yeah sorry,. re-read original.... but it still should be a post method i think.

what XML do you get back ?
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Nico2011Author Commented:
have changed to post - sorry but I don't know how to get the XML back - this is all new to me!
0
 
Carl TawnSystems and Integration DeveloperCommented:
Change your code to the following and see what message you get:
  Set objSrvHTTP = CreateObject("Msxml2.ServerXMLHTTP.6.0")
   
   url = "https://api.clickatell.com/http/sendmsg?user=[UserID]&password=[password]&api_id=[API_ID]&to=[phone_number]&text=Test Message"
   objSrvHTTP.open "GET", url
   objSrvHTTP.send

   objXML = objSrvHTTP.responseText   

   WScript.Echo objXml
   
WScript.Quit

Open in new window

0
 
Nico2011Author Commented:
Thanks Carl - the XML feedback told all - it was an IP lockdown... I shared the points as best I could as both were headed in the right direction, but Carl gave me the whole code!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now