Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting from VB6 to VB 2008 - HTTP Request 1

Status
Not open for further replies.

ShaneBrennan

Programmer
May 19, 1999
198
GB
Hi Everyone, not sure if this is the right thread/forum to put this... but I'm having issues trying to convert the following code from VB6 to VB2008. All it dowes is posts to a URL the locationID and the site returns an XML of the data stored there. But I haven;t a clue how to do it. All sites I can see give .NET equivalents. Thanks in advance for any help anyone can give.

CurrentTimeFormatted = Format(Date, "yyyy-mmm-dd-hh-nn")
CurrentTimeFormatted = URLencshort(CurrentTimeFormatted)
Dim html As IXMLHTTPRequest

Set html = CreateObject("Microsoft.XMLHTTP")


URLString = GetSetting("HTTPServerPath") & "GetAsbestosbyLocation.asp?LocationID=" & TheLocationID & "&t=" & CurrentTimeFormatted
With html

.Open "GET", URLString, False
.send
TheXMLContent = .responseText
End With

Shane Brennan


 
Found Solution... easy once I put my brain into gear:

CurrentTimeFormatted = DateTime.Now.ToString("yyyy-mmm-dd-hh-mm-ss")
CurrentTimeFormatted = URLencshort(CurrentTimeFormatted)
Dim html As MSXML2.IXMLHTTPRequest
html = CreateObject("Microsoft.XMLHTTP")
URLString = GetSetting("HTTPServerPath") & "GetAsbestosbyLocation.asp?LocationID=" & TheLocationID & "&t=" & CurrentTimeFormatted
With html

.open("GET", URLString, False)
.send()
theXMLContent = .responseText
End With

Shane Brennan


 
Thanks for coming back to post your solution.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top