Solved

HTTP GET/POST

Posted on 2008-06-20
4
281 Views
Last Modified: 2013-11-26
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
Comment
Question by:JOHNFROG
  • 3
4 Comments
 
LVL 2

Expert Comment

by:balochdude
ID: 21832001
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
 
LVL 2

Expert Comment

by:balochdude
ID: 21832029
Use WebRequest AND WebResponse

-- OR --

Use HTTPWebRequest
0
 
LVL 2

Accepted Solution

by:
balochdude earned 500 total points
ID: 21832109
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
 

Author Comment

by:JOHNFROG
ID: 21836231
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

23 Experts available now in Live!

Get 1:1 Help Now