HTTP Utils2 help

walterf25

Expert
Licensed User
Longtime User
Hello Erel, I need help, i'm working on this app which up until now everything works great, thanks to this great httputil class.
However when i send this request
I get no error but i get nothing when i try to read with textreader.
I checked the file that gets saved to the SD card and in fact it is empty, i have been trying to figure out all day but i've had no luck, however when i send this other request
and then check the file saved in the sd card i do see the html data.
Can you help me figure this out, when i copy and paste both urls to my browser i can see they both work, but i can't figure out why the first url does not return any information.

Here's the jobdone code

B4X:
queryresult = "https://thepiratebay.se/search/Batman/0/99/0"
job4.Initialize("Query_Result", Me)
job4.Download(queryresult)

Sub JobDone(Job As HttpJob)
   Select Job.JobName
      Case "Main page"
         HandleMainPage(Job)
      Case "ImageJob"
         ImagesJobDone(Job)
      Case "Query_Result"
         QueryResults(Job)
   End Select
   Job.Release
End Sub

Sub QueryResults (Job As HttpJob)
If Job.Success = True Then
Log("job4 was succesful")
End If

Dim line3 As String
Dim TextReader3 As TextReader
TextReader3.Initialize(Job.GetInputStream)


Do While line3 <> Null

line3 = TextReader3.ReadLine
ToastMessageShow("read line: " & line3, True)
Loop

End Sub

Your help will be greatly appreciated Erel.

Cheers,
Walter
 

walterf25

Expert
Licensed User
Longtime User
Hi Erel, the code doesn't give me any errors, i checked and in fact the job returns succes= true the html file actually gets created but when i open it there's nothing in it, if i try the second url link i can actually see data in the html file returned, it's just the first url link that gives me this problem.
Basically i'm using a search dialog that i found here http://www.b4x.com/forum/basic4android-getting-started-tutorials/15490-using-standard-android-search-dialog-basic4android.html#post87944

when the user presses go then i parse the word typed and insert it into the url link to search for that specific movie.

I changed the code to read the file only when sucess = true and although it returns success = true it still doesn't return any data in the HTML file.

B4X:
Sub QueryResults (Job As HttpJob)
If Job.Success = True Then
Log("job4 was succesful")
Log("string read: " & Job.GetString)
Dim line3 As String
Dim TextReader3 As TextReader
TextReader3.Initialize(Job.GetInputStream)
Do While line3 <> Null
line3 = TextReader3.ReadLine
ToastMessageShow("read line: " & line3, True)
Loop
End If
End Sub

this is the log:
job4 was succesful
string read:

the other url links i'm working with work just fine and return the expected data.

Can you help me figure this out please Mr. Erel.
:BangHead:

Thanks
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Erel, if that is the case then why would the other url link work and not the first one, both urls are used to get information from the same website?

I'm consfused

firebug is only for firefox is there anything else for google chrome or IE?

thanks,
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
HTTPUtils2 help

Thanks Erel, ok so what do i need to look for now, you mentioned that i need to look for the required headers, what is that exactly, i'm sorry if i sound ignorant but i really need your help with this.

Thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
HTTPUtils2 help

Ok, this is what i get so far

i'm not sure what to do with this information, any suggestion Erel?

Thanks,
Walter
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Erel, one more time you're my hero, thank you so much for helping me with this, i have to say Basic4Android is the best software for Android i've found so far and the community and the support is just priceless, thank you so much Erel.

This worked great.

:sign0188::sign0188::sign0188:

Thank you!
 
Upvote 0

NFOBoy

Active Member
Licensed User
Longtime User
Erel, just wanted to pile on the Thanks here, as this is exactly what I needed to add to your HttpUtils2 library to get what I needed to come down the pipe.

So, Thanks so much.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…