Android Question What is the best way to send a URL

fdx12345

Active Member
Licensed User
Longtime User
I need to send a URL string. I can take the url+sring and paste it into any browser and I get a page full of JSON data. What can I use in B4A to send that URL= string? I have tried job1.download but that does not work and I have tried using job1.download but get errors of an illegal argument exception, Illegal character in query. However all of the characters are required in the URL. It is a very long string which I have on one line incase that is an issue.
 

fdx12345

Active Member
Licensed User
Longtime User
Here is the string I am trying to send. I reduced the long Https address to just https://serverlocation?channels for the purpose of this example. Works fine if I cut/paste it into a browser address line. I get an illegal character error. The format is fixed via the requirements of the third party API and must be Http ver 1 standard. What is sent back is a Json response.


https://serverlocation?channels=1,6...4,75,76,77,78,79,80,82,83,84,85&startTime=Wed Dec 31 2015 11:00:00 GMT-0600 (Central Standard Time)&hours=8&chIds=238,2071,2073,2076,6069,6092,2075,4317,6111,3849,6148,1977,6209,1978,354,4328,553,219,5239,392,1975,358,361,1974
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
for the purpose of this example

so, to send

you should do it something like this

B4X:
    Dim job As HttpJob
    job.Initialize("JobName",Me)
    job.Tag = "TheTAG"
    job.Download2("https://serverlocation?",Array As String("channels","1,6...4,75,76,77,78,79,80,82,83,84,85","startTime","Wed Dec 31 2015 11:00:00 GMT-0600 (Central Standard Time)","hours","8","chIds","238,2071,2073,2076,6069,6092,2075,4317,6111,3849,6148,1977,6209,1978,354,4328,553,219,5239,392,1975,358,361,1974"))
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
OK that makes sense. There use to be a spot somewhere on here where we could go and browse the individual library calls inside of each library. We could see all support modules in that library and an example how to use them but I cannot find that spot.
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
I put the string together as demonstrated above but get the error "JSONException: End of input at character 0 -syntaxError.

My line looks like this: job1.Download2("webaddress", Array As String("?channels=1,6,15,17,22,47,53,65,70,70,71,72,73,74,75,76,77,78,79,80,82,83,84,85&startTime=Wed Jan 03 2016 11:00:00 GMT-0600 (Central Standard Time)&hours=8&chIds=238,2071,2073,2076,6069,6092,2075,4317,6111,3849,6148,1977,6209,1978,354,4328,553,219,5239,392,1975,358,361,1974"))
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
No. I just copy\paste the whole thing as is into a browers address bar and it works fine.
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Is there any way of sending that URL? I just need to do the same thing as copy/paste into a browsers address box. The results are sent back and come in the form of a web page full of data.
 
Upvote 0

fdx12345

Active Member
Licensed User
Longtime User
Well that must be my problem. I have tried different ways to encode the URL but obviously do not understand the encoding requirements. The string is above. Can you help me with this?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…