(VBScript) Example: Http.QuickGetSb method
Demonstrates the QuickGetSb method.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set http = CreateObject("Chilkat.Http")
' Send the HTTP GET and return the content in a StringBuilder
set sb = CreateObject("Chilkat.StringBuilder")
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb)
If (http.LastMethodSuccess = 0) Then
If (http.LastStatus = 0) Then
' Communications error. We did not get a response.
outFile.WriteLine(http.LastErrorText)
Else
outFile.WriteLine("Response status code: " & http.LastStatus)
outFile.WriteLine("Response body error text:")
outFile.WriteLine(sb.GetAsString())
End If
WScript.Quit
End If
' The downloaded content:
outFile.WriteLine(sb.GetAsString())
outFile.WriteLine("Success")
outFile.Close
|