GET URL problem

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jrioux
Posts: 50
Joined: Fri May 04, 2007 4:02 pm

GET URL problem

Post by jrioux » Thu Aug 02, 2012 5:24 pm

get URL "http://www.mydomain.com/directory/anoth ... myText.txt" returns the text from the file I want, beautifully
get URL "http://www.mydomain.com/directory/anotherDirectory/my Text.txt" returns a bad request error,
get URL (urlEncode("http://www.mydomain.com/directory/anotherDirectory/my Text.txt")) returns the urlEncoded string, not the text from the file I want
so, too, with get URL urlEncode("http://www.mydomain.com/directory/anotherDirectory/my Text.txt")

As is often the case with me, there's probably a very simple explanation. I do know that spaces in the path name is part of the problem, but I thought URLencoding it was the solution.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: GET URL problem

Post by Klaus » Thu Aug 02, 2012 5:40 pm

Bonsoir jrioux,

just replace SPACE with %20 in the url, works fine! :D
...
put "http://www.mydomain.com/directory/anotherDirectory/my Text.txt" into tURL
replace SPACE with "%20" in tURL
get url tURL
...
Or write a little function to do so...


Best

Klaus

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Location: Thailand
Contact:

Re: GET URL problem

Post by dave_probertGA6e24 » Thu Aug 02, 2012 5:49 pm

Hi jrioux,

I came across a similar problem with URL before and had to split the call over two lines:

put URLEncode("http://x.com/blah blah.txt") into tURL
put URL tURL into tVar

It seems that the URL command will not evaluate the output from some functions and so dumps the text itself into the variable. Weird.

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: GET URL problem

Post by Klaus » Thu Aug 02, 2012 5:58 pm

Hi Dave,

this will not work e.g. with the new german UMLAUT urls like:
http://www.müller.de -> http%3A%2F%2Fwww.m%9Fller.de 8)
Best is to only replace SPACE in URLs.

Best

Klaus

jrioux
Posts: 50
Joined: Fri May 04, 2007 4:02 pm

Re: GET URL problem

Post by jrioux » Thu Aug 02, 2012 6:50 pm

Klaus and Dave,

Many thanks!

Post Reply

Return to “Internet”