I have some code in Basic4PPC which fetches a web-page (a URL to which I add parameters) which I thereafter use for parsing.
When trying the same in Basic4Android, it will only return the fetched page partially (it seems to fetch only the html-body) and then it stops. Same page loads nicely in B4A Webview but there is no way I can read the HTML-source in WebView for parsing the result.
In Basic4PPC I use the HTTP-library. Part of the code used to retrieve the data is as follows:
'Basic4PPC
Sub GetText
URL="http://" & main.myIPAddress & ":" & main.myport & "/getMultiEPG?ref=4097:7:0:dbe02:0:0:0:0:0:0:/var/tuxbox/config/enigma/userbouquet.dbe02.tv"
' 4097:7:0:dbe02....... is a parameter I add to the URL
response.New1
If main.UsernameToUse="" OR main.PasswordToUse ="" Then
request.New1(URL)
Else
request.New3(URL, main.UsernameToUse,main.PasswordToUse)
End If
response.Value=request.GetResponse
String=response.GetString
response.Close
Return String
End Sub
Here is a snippet of the code used in Basic4Android:
'Basic4Android
Sub GetEPGData
Dim URL_EPGDATA_E1 As String
Dim request As HttpRequest
Dim myIP As String
HttpGetEPGData.InitializeAcceptAll("HttpGetEPGData")
myIP = main.BoxIP
URL_EPGDATA_E1="http://" & myIP & ":" & main.BoxPort & "/getMultiEPG?ref=4097:7:0:dbe02:0:0:0:0:0:0:/var/tuxbox/config/enigma/userbouquet.dbe02.tv"
request.InitializeGet(URL_EPGDATA_E1)
request.Timeout = 5000
If HttpGetEPGData.ExecuteCredentials(request,1,main.BoxUser,main.BoxPassword)=False Then Return
End Sub
Sub HttpGetEPGData_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim myEPGDataReply As String
myEPGDataReply=Response.GetString("UTF8")
Log(myEPGDataReply)
End sub
Both in B4PPC and B4A, I use Response.GetString to collect the data.
I don't know much about HTTP Post, HTTP Get and I can't understand why in B4PPC I get all data while in B4A only partial data. It seems like the two HTTP-libraries are behaving differently.
I read that in B4A the HttpRequest is asynchronous. I don't know about B4PPC. Could this be the problem? If I want to make a synchronous HttpRequest, how do I do it?
Can I use any other method to see if I can retrieve the whole amount of data? If yes, a short example would be nice since, as I already said, I don't know much about HTTP-stuff.
BTW: the B4A HTTP-library is version 1.08 which I guess is the latest
Many thanks in advance for your help.