HttpRequest error

Tadder

Member
Licensed User
Longtime User
I'm trying to download a csv file from mysql server. I'm hosting my server locally (and connecting thru my phone over the cellular network), i do not have a website, only my public IP: port. I'm wondering if there is any limitation on the URL input to Job1.Download?? can i NOT use an IP address?

i'm using the following code with HttpUtils2Service and HttpJob modules:

B4X:
Sub btn_show2DLV_Click
   Dim Job1 As HttpJob
   Job1.Initialize("Job1", Me)
   Job1.Download("<xx.xx.xx.xx:xxxx>/" & spn_mfrs.SelectedItem & ".csv")
End Sub

it errors on req.InitializeGet(Link) within the HttpJob module, although the string is accurate (xx.xx.xx:xxxx/filename.csv). the error is
Illegal character in the scheme at Index 0: (lists the IP string)
B4X:
Public Sub Download(Link As String)
   mLink = Link
   req.InitializeGet(Link)
   CallSubDelayed2(HttpUtils2Service, "SubmitJob", Me)
End Sub
thanks in advance!
 

Tadder

Member
Licensed User
Longtime User
Im guessing you need to pass something like:
http://205.121.21.2:8080/filename.csv

Are you sure you add the protocol name and a valid IP address?

yes, i figured it out and was in the middle of editing my first post when i saw that you answered it. here was my response :)

It's funny how when you spend 10 minutes putting a question together you sometimes figure it out when organizing (and re-organizing) your question so others can understand it.

the issue with my code was i was specifying ONLY the IP address (not http://). i changed the code to
B4X:
Job1.Download("http://xx.xx.xx.xx:xxxx/" & spn_mfrs.SelectedItem & ".csv")
and it now works just fine!

I'm catching on (slowly but surely).
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
It's funny how when you spend 10 minutes putting a question together you sometimes figure it out when organizing (and re-organizing) your question so others can understand it.
This is so true. Sometimes I just write down my problem so I understand it myself and 90% of the time I find the solution before I click on 'Post'.
 
Upvote 0
Top