HTTP Request Without curl or wget (Ubuntu Core Bash)

Maciek Rek picture Maciek Rek · Feb 18, 2018 · Viewed 9.4k times · Source

How do I make a HTTPS (or HTTP) request in Ubuntu Core? The curl and wget are unavailable (and I don't know of any alternatives).

I am trying to update the DtDns with this line: https://www.dtdns.com/api/autodns.cfm?<options>

--

Edit
Wasn't able to find any quick'n'easy solution therefore took a longer detour and learned about creating snaps with snapcraft (in classic mode). Then simply included curl in the snap along with my bash script. Here is an excerpt from my snap.yaml:

apps:
  my-app:
    command: my-app.sh
    daemon: simple
    restart-condition: always

parts:
  client:
    plugin: dump
    source: my-app-src/
    stage-packages: 
      - curl

A good starting point: How to build a snap – tutorial.

Answer

kyrofa picture kyrofa · Feb 18, 2018

You should install the classic snap, which allows you to use tools like curl and wget. From the developer tools page:

$ snap install classic --edge --devmode

Then get into the classic shell (allowing you to use apt):

$ sudo classic