0
PureBasic增加了一个JSON库,因此它可以很好地处理网页内容。但我不知道我从ReceiveHTTPFile()
函数得到什么类型的输出。PureBasic中的ReceiveHTTPFile函数的输出在哪里?
他们的文档在这个主题上相当稀少。
这是我的代码。
Procedure GetBitminterData()
FireUpNetwork = InitNetwork()
Debug "If the number below is anything other than zero the network library is working."
Debug FireUpNetwork
URL$ = "https://bitminter.com/api/pool/stats/"
FileName$ = "stats.json"
BitMinterData = ReceiveHTTPFile(URL$, Filename$) ;THIS LINE HERE MEH
Debug URL$
Debug BitMinterData
; Read JSON data from a string
; More importantly parse the bitminter stats.json file from above.
Input$ = BitMinterData
If ParseJSON(#JSON_Parse, Input$)
NewList Numbers()
ExtractJSONList(JSONValue(#JSON_Parse), Numbers())
Debug "---------- Extracting values ----------"
Debug ""
ForEach Numbers()
Debug Numbers()
Next
EndIf
EndProcedure
[文档](http://www.purebasic.com/documentation/http/receivehttpfile.html)非常清楚。 “如果下载成功则返回非零值,否则返回零。”如果下载失败,则返回零;任何其他值意味着它的工作。哪一部分难以理解?你的代码尝试使用返回值作为输入('Input $ = BitMinterData'),这似乎表明你认为你得到的文件作为结果。您不是 - 该文件位于磁盘上,并具有您在'FileName $'中提供的文件名(也在同一文档链接的“参数”部分中对其进行了描述)。 – 2014-10-19 04:32:58
在PureBASIC 5.40中,https是acepted。 – 2015-12-03 15:54:19