get url(any/success?someone)

Bringing your stacks to the web

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
hliljegren
Posts: 107
Joined: Sun Aug 23, 2009 7:48 am
Contact:

get url(any/success?someone)

Post by hliljegren » Thu Sep 24, 2015 9:00 am

Have anyone succeeded to use get URL?

If I put my LiveCode project files on a server at
http://www.example.com/test/

and then try to get a file via:

Code: Select all

get url "http://www.example.com/test/text.txt"
I get an assertion failure. Anyone having tried the get url command with a successful result?
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: get url(any/success?someone)

Post by peter-b » Thu Sep 24, 2015 9:05 am

Unfortunately we have a known issue with most commands that need to wait for something to happen, because JavaScript makes it very difficult.

You should be able to do:

Code: Select all

put URL "<url>" into tVariable
But that's the only URL syntax that's expected to work at the moment. Sorry! We plan to address this soon (but it turns out be rather tricky to do without making the whole engine really really slow).
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

hliljegren
Posts: 107
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: get url(any/success?someone)

Post by hliljegren » Thu Sep 24, 2015 4:05 pm

Thanks! I'm sure that I tried that first but tried again now and it somewhat works.

I have a card with two fields: URL, Result and a button with the following code:

Code: Select all

on mouseUp
   put field "URL" into tURL
   put url tURL into tData
   if the result is empty then
      put tData into field "Result"
   else
      put the result into field "Result"
   end if
end mouseUp
My minimal test.php looks like:

Code: Select all

<?php

 echo "Hello ". $_GET["name"] . "!";

?>
If I go to my_server.com/some/folder/index.html it always work, but, if I go to a php file in the same folder: my_server.com/some/folder/test.php?name=world it fails around 50% of the times. the result is then Request failed. So it goes kind of like this (for test.php):

Click : Request failed
Click : Request failed
Click : Hello world
Click : Hello world
Click : Hello world
Click : Request failed
Click : Hello world
...
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

hliljegren
Posts: 107
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: get url(any/success?someone)

Post by hliljegren » Thu Sep 24, 2015 4:09 pm

Looking at the JavaScript console I see that every time when the request fails I see that I get :
Failed to load resource: The request timed out.
I have similar experience across supported browsers.
___________________________________
MacBook Pro, 15" 2.6GHz i7 Mac OS X 10.10.4
iMac 27", 3.2 GHz Quad i7, Mac OS 10.10.4
LiveCode 7.0.6 or 8.0dp4

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: get url(any/success?someone)

Post by peter-b » Mon Sep 28, 2015 9:48 am

You can change the timeout used by HTTP requests by setting

Code: Select all

the socketTimeOutInterval
: https://livecode.com/resources/api/#liv ... utinterval
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

Kangaroo SW
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 24
Joined: Sat Jan 15, 2011 10:57 am

Re: get url(any/success?someone)

Post by Kangaroo SW » Tue Oct 20, 2015 8:45 am

@ hliljegren

Can you/someone which has successfully been able to load a text file into a stack, please send an example stack here
which works ?!

I tried all combinations I can think of and also the trick wich puts an URL into a variable first, and then display it ...

Nothing worked so far :-(

MadManSoft
Posts: 35
Joined: Fri Apr 12, 2013 9:15 pm

Re: get url(any/success?someone)

Post by MadManSoft » Tue Feb 16, 2016 4:00 pm

I have been unable to get this working in DP14, using get URL or put URL.

It will lock the browser :(

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6211
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: get url(any/success?someone)

Post by FourthWorld » Tue Feb 16, 2016 5:06 pm

hliljegren wrote:Looking at the JavaScript console I see that every time when the request fails I see that I get :
Failed to load resource: The request timed out.
I have similar experience across supported browsers.
If you're getting frequent timeouts the best you can do is to report the timeout error as suggested, but that won't fix the actual problem.

The server has an issue. You'll need to find it out it can't deliver the requested file in a timely manner.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1808
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: get url(any/success?someone)

Post by [-hh] » Tue Feb 16, 2016 7:15 pm

URL-methods with extern sources do currently NOT (yet) work in HTML5 standalones.

These methods would require the wait-syntax which causes an overall slowdown by a factor > 200.
That's why it has been disabled again in 8.0.0-dp14.

The above is my short summary from several posts and notices of Peter here and in the use-list.
Please correct me if I'm wrong.
shiftLock happens

Post Reply

Return to “HTML5”