URL, shell(curl), Why is LC so frustrating?

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
rrBUSS9EE
Posts: 98
Joined: Wed May 02, 2012 3:46 pm

URL, shell(curl), Why is LC so frustrating?

Post by rrBUSS9EE » Wed Aug 13, 2014 2:08 am

So I want to get the contents of a URL during openStack, but it returns empty.

Now I remember something from years ago that there is an issue with when LC's internet library loads and that you have to do something or other, or wait for some point, or jump through some other hoops before you can call this function... but can't remember it, and couldn't find reference to it via search so I move on. So I'll use the shell function and curl.

'curl http://blahBlahBlah/myfile.txt' in bash shell returns:

123416
123429

But:
get "curl http://blahBlahBlah/myfile.txt"
get shell(it)

returns:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 13 100 13 0 0 28 0 --:--:-- --:--:-- --:--:-- 28
123416
123429


WTF!

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 698
Joined: Wed Nov 22, 2006 3:42 pm
Location: France
Contact:

Re: URL, shell(curl), Why is LC so frustrating?

Post by Thierry » Wed Aug 13, 2014 6:10 am

rrBUSS9EE wrote: 'curl http://blahBlahBlah/myfile.txt' in bash shell returns:

get "curl http://blahBlahBlah/myfile.txt"
get shell(it)
You could try curl silent mode;

From memory, it should be -s, but check the man pages if it doesn't work.

The difference calling curl from shell and lc is there should be a curl config file
which the shell might read (depends on your OS, version,...) but not lc.

HTH,

Thierry
Regex LiveCode sunnYrex
https://sunny-tdz.com

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1682
Joined: Sat Feb 28, 2009 11:49 pm

Re: URL, shell(curl), Why is LC so frustrating?

Post by sturgis » Fri Oct 03, 2014 7:28 pm

Seems that openstack should work, but I guess its possible the library still isn't loaded. Might try using opencard (fires later) and/or using a send in time to do the work. I assume you can get it to work after complete load?

Might also look at the contents of "the result" after the command.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2960
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: URL, shell(curl), Why is LC so frustrating?

Post by mwieder » Sun Oct 05, 2014 1:59 am

Also, since curl acts a bit differently on linux and osx, at least with respect to client certificates, I use wget instead of curl. There are options to return just the data, not any of the statistics. From memory they're

-O- -o /dev/null

Shelling out to curl or wget or httpie should be completely independent of the libURL library, so when it loads shouldn't be a problem.

Post Reply

Return to “Mac OS”