Bwyss
Bwyss

Reputation: 1834

How can I trigger a url from the terminal

Ok, I know this is one odd question, how can I run a html url from the terminal? Let me explain...

I have a shell script that is using the an api to update a record in a database, looks something like this:

http://{account}.cartodb.com/api/v2/sql?q=UPDATE test_table SET column_name = 'my new string value' WHERE cartodb_id = 1 &api_key={Your API key}

How can I run the above from my shell script so that it will have the same effect as when it is run in a browser?

Upvotes: 2

Views: 5252

Answers (2)

Michael
Michael

Reputation: 148

Try this:

wget "http://{account}.cartodb.com/your/api?call= etc." -qO-

If your return page generate a lot of output, use less:

wget "http://{account}.cartodb.com/your/api?call= etc." -qO- | less

Or if you don't care about the output result:

wget "http://{account}.cartodb.com/your/api?call= etc." -q -O /dev/null

Upvotes: 4

Arthur S.
Arthur S.

Reputation: 111

If you are asking about text based browsers there are quite a few.

However, running it from a script means you'll want it to be non-interactive and possibly to throw away the output.

e.g. lynx -dump {some_url} 2>/dev/null.

other command line browsers include w3c, links, elinks.

You might also want to use wget or curl for some operations.

Upvotes: 1

Related Questions