我如何使用 XOJO 从 Web 加载 JSON?

How can I load JSON from the Web with XOJO?

我是 XOJO 的新手,我正在制作一个 Web 应用程序来列出我同事的时间条目。

代码如下所示:

Dim Socket as new HTTPSocket
Dim d As New Dictionary
Dim result As String

Socket.SetRequestContent("","application/json; charset=utf-8")
result = Socket.get("http://teamwork.companyname.com/time/total.json?userId=111111", 30) 
result = DefineEncoding(result, Encodings.UTF8)

OutputArea3.Text = result

当我用 www.example.com 替换 URL 时,它起作用了,内容 可以 被加载。 我还针对来自 Web 的不同 JSON 对各种 URL 进行了尝试,但它也没有用。

我应该使用什么才能加载 JSON?

非常感谢您的建议

我自己解决的。我创建了一个名为 CustomHTTPSocket 的 HTTPSocket 子类,并通过我的登录实现了 AuthenticationRequired 事件:

name="username"
password="password"
return true

现在可以了:)