I'm having a little trouble with httputils2 and json.
I have two URLs and one of them Work in my program but the other does not.
Funny part is if I enter the two URLs in my browser they both return an json file.
But in my code I get an error on one of them.
URL1: (this one is giving me an error in B4A)
http://www.broens-byfest.dk/?json=get_category_posts&category_slug=Nyheder
URL2: (this one works okay. I know its not the same result)
http://www.broens-byfest.dk/?json=get_tag_post&tag_slug=nyheder
This is my download code:
This is my JobDone code
The ParseJson is the sub to parse the json, but in URL1 the s variable gives me a string with error.
I cant figure out what is wrong. Can any one help?
I have two URLs and one of them Work in my program but the other does not.
Funny part is if I enter the two URLs in my browser they both return an json file.
But in my code I get an error on one of them.
URL1: (this one is giving me an error in B4A)
http://www.broens-byfest.dk/?json=get_category_posts&category_slug=Nyheder
URL2: (this one works okay. I know its not the same result)
http://www.broens-byfest.dk/?json=get_tag_post&tag_slug=nyheder
This is my download code:
B4X:
nyhedsJob.Initialize("nyhedsJob", Me)
nyhedsJob.Download2(UrlNyheder, Array As String("first key", "first value", "second key", "second value"))
This is my JobDone code
B4X:
Sub JobDone(Job As HttpJob)
Log("string = " & Job.GetString)
If Job.Success = True Then
Select Job.JobName
Case "nyhedsJob"
'** Det hentede JSON skal gemmes på telefonen
Dim s As String
Dim TextWriteNyheder As TextWriter
s = Job.GetString
TextWriteNyheder.Initialize(File.OpenOutput(File.DirInternal, "nyheder.json", False))
TextWriteNyheder.Write(s)
TextWriteNyheder.Close
'** Parse det hentede JSON data
ParseJson
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
End Sub
B4X:
{"status":"error","error":"Not found."}