Solved

Post HTTP Using VBScript

Posted on 2014-04-03
6
3,440 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
  • 3
  • 2
6 Comments
 
LVL 32

Expert Comment

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

objSrvHTTP.open "POST", url
0
 

Author Comment

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

Assisted Solution

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

what XML do you get back ?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Nico2011
Comment Utility
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 350 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now