[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

HTTP GET/POST

I need to code a http post to request something from a remote server and receive a response. I simply want to integrate sms functioality into my website. I have an account set up with the company at the following website and all I want to do is plug into their sms functionality.

This is the website
http://www.smsglobal.com.au/api/http.html
Can anyone give me some clues on where to start? I am developing using VB and visual Studio 2008,

I just want an ascx and aspx that would connect to the above service.

0
JOHNFROG
Asked:
JOHNFROG
  • 3
1 Solution
 
balochdudeCommented:
Use WebRequest or WebResponse.

      Dim objWebRequest As WebRequest = WebRequest.Create(strURL)
      Dim objWebResponse As WebResponse = objWebRequest.GetResponse()
      Dim objStream As Stream = objWebResponse.GetResponseStream()
      Dim objStreamReader As StreamReader = New StreamReader(objStream)
      Dim strHTML As String = objStreamReader.ReadToEnd
0
 
balochdudeCommented:
Use WebRequest AND WebResponse

-- OR --

Use HTTPWebRequest
0
 
balochdudeCommented:
HTTPWebRequest Example:

Its not the complete code but it will give you some idea (and its not tested code):

Dim smsRequest as HttpWebRequest = WebRequest.Create("http://www.smsglobal.com.au.http-api.php?action=ACTION&user=USERNAME&
password=SECRET&from=FROMNUMBER&to=61409317436&text=Hello%20world");
smsRequest.Method = "POST"
smsRequest.ContentType="application/x-www-form-urlencoded"
Dim st as Stream = smsRequest.GetRequestStream()
' Send data with st and close st
0
 
JOHNFROGAuthor Commented:
Nice one. Actually I took that and then found
http://www.asp101.com/samples/http_post_aspx.asp which I would thoroughly recommend to anyone foloowing the solution.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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