?
Solved

Post HTTP Using VBScript

Posted on 2014-04-03
6
Medium Priority
?
4,122 Views
Last Modified: 2014-04-03
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
Comment
Question by:Nico2011
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 39974715
shouldnt you be using POST method when sending data.

objSrvHTTP.open "POST", url
0
 

Author Comment

by:Nico2011
ID: 39974719
As I mentioned above - I tried both POST & GET - neither work
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 600 total points
ID: 39974723
yeah sorry,. re-read original.... but it still should be a post method i think.

what XML do you get back ?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Nico2011
ID: 39974733
have changed to post - sorry but I don't know how to get the XML back - this is all new to me!
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 1400 total points
ID: 39974778
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
 

Author Closing Comment

by:Nico2011
ID: 39974830
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question