[Question]
  [
# Introduction
Yes, it's as simple as that. Download any file from the internet!
# Rules
You must use your language's API.
You must output the file you downloaded to STDOUT, the console, a file, etc.
Input should be empty, or the URL you wish to download, but the url must count to byte count..
Good luck!
  
[Answer]
# Bash, ~~21~~ ~~17~~ ~~11~~ ~~9~~ 7 bytes
```
curl ai
```
[Answer]
# [R√∂da](https://github.com/fergusq/roda), 29 bytes
```
{saveResource"http://ai","a"}
```
This is an anonymous function that creates a file `a` containing the HTML code of `http://ai`.
[Answer]
# MATL, 8 bytes
```
'v.ht'Xi
```
The URL provided to `Xi` (`urlread`) is prepended with `http://` if it isn't already. Additionally the output of `urlread` contains the contents of the response and this is implicitly printed when the program exits.
Unfortunately this does not work for the online compilers since loading data from an arbitrary URL is disallowed in online-mode, so here's a GIF.
[![enter image description here](https://i.stack.imgur.com/RCSil.gif)](https://i.stack.imgur.com/RCSil.gif)
[Answer]
# Bash, ~~45~~ 43 bytes
```
exec 3<>/dev/tcp/ai/80;echo GET />&3;cat<&3
```
opens a tcp socket with ai site on file descriptor 3, issues a get, and cats the result.
perhaps can be golfed further.
[Answer]
# PowerShell, 7 Bytes
Since we're all using `www.ai`...
```
irm ai.
```
uses `Invoke-RestMethod` - prints the result to StdOut
alternate answer, saves to file named 'a' in run directory, using `Invoke-WebRequest` and `-OutFile` param.
```
iwr ai. -OutF a
```
[Answer]
## Mathematica 18 Bytes
```
URLDownload@"v.ht"
```
[Answer]
## C#, 96 93 bytes
```
async()=>Console.Write(await new System.Net.Http.HttpClient().GetStringAsync("http://3.ly"));
```
[Answer]
# PHP, 22 bytes
If `allow_url_include=1` is in your ini file:
```
<?=include"http://ai";   
```
[Answer]
# JS (ES6), ~~38~~ ~~36~~ ~~31~~ 29 bytes
```
fetch`//ai`.then(x=>x.text())
```
Depending on the promise consensus, (41 bytes)
```
fetch`//ai`.then(x=>x.text()).then(alert)
```
[Answer]
# C (Clang, ARMv7-a Linux/Android, AT&T Wireless), 162 bytes
Since we're hardcoding URLs, why not hardcode ISPs?
```
main(s){int b[500]={5<<28|2,**((int***)gethostbyname("ai"))[4]};connect(s=socket(2,1,0),b,16);write(s,"GET / HTTP/1.0\n\n",16);read(s,b,-1);read(s,b,-1);puts(b);}
```
I can't show a demo because none of the demos have online enabled :(
This abuses two things. One is that I assume `http://ai` is smaller than 2000 bytes and just casually read a max of 4GB onto the stack (what could possibly go wrong), and two is that I take advantage of how I discovered that AT&T Wireless converts `\n` to `\r\n` in HTTP requests for some reason (new data saving hack?).
Termux screenshot, showing how it works on data (AT&T via Cricket) but *not* on my Wi-Fi (Xfinity).
![The only thing AT&T is good for?](https://i.stack.imgur.com/nvKvs.png)
Ungolfed and commented:
**note**: I have removed the punning and buffer reusing for this.
```
#include <unistd.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
int main(void)
{
    // Look up the IP address of http://ai
    // Note that I mess around with type punning and the documented
    // layout of the structure in the golfed version.
    struct hostent *ent = gethostbyname("ai");
    // Extract the first IP address (already in network order)
    uint32_t ip;
    memcpy(&ip, ent->h_addr_list[0], sizeof(uint32_t));
    // Create the sockaddr struct
    struct sockaddr_in header = (struct sockaddr_in) {
        .sin_family = AF_INET,
        .sin_port = htons(80),
        .sin_addr = { ip }
    };
    // Copy over to the pun
    struct sockaddr_storage header_raw;
    memcpy(&header_raw, &header, sizeof(header));
    // Create an IPv4 socket
    int soc = socket(AF_INET, SOCK_STREAM, 0);
    // Connect the socket to the interwebs
    connect(soc, (const struct sockaddr *)&header_raw, sizeof(header_raw));
    // Send an HTTP GET request
    // Note that because It Works‚Ñ¢ on AT&T, I use \n instead of the proper \r\n. Two newlines are still required though.
#ifdef ATT
    const char get_request[] = "GET / HTTP/1.0\n\n";
#else
    const char get_request[] = "GET / HTTP/1.0\r\n\r\n";
#endif
    write(soc, get_request, strlen(get_request));
    char buf[2000] = {0};
    // Note: I use -1 to just read the entire thing. Hopefully it is all shorter than
    // 1999 chars :P
#ifdef BUF_HACK
    size_t len = -1;
#else
    size_t len = sizeof(buf) - 1;
#endif
    // Receive the HTTP response header
    read(soc, buf, len);
    // But ignore it because I don't care about parsing HTTP stuff
    // Just read again for the real data
    read(soc, buf, len);
    // Print to stdout (assuming the HTTP header was shorter)
    puts(buf);
    // I don't actually bother closing the socket in the golfed code, sue me.
#ifndef RESOURCE_HOG
    close(soc);
#endif
}
```
I just decided to see how painful this was, I knew before I started that it didn't have a chance. üòè
[Answer]
# R, 24 bytes
```
readLines('http://g.co')
```
prints the output to console in the usual R format -- vector of strings, one element per line of the site.
[Answer]
# Mathematica, 13 bytes
```
URLFetch@"ai"
```
[Answer]
# Python 2, ~~55~~ ~~49~~ 47 bytes
~~Not shorter but~~ I really thought I could go further.
```
from urllib import*
urlopen('http://ai').read
```
[Answer]
# Vim Ex command, 14 bytes
```
e http://3.ly/
```
Opens the URL as a new buffer. Netrw seriously suffers from a restrictive URL format.
[Answer]
## nc -v v.ht 80 < file - 31 bytes
Where file contains:
```
GET / HTTP/1.1\r\n
Host: v.ht\r\n
\r\n
```
I profess ignorance about how I should score this. The file is 31 bytes and contains the URL I want, the `-v` flag value decides if I get the file I want or an error response.
[Answer]
# Racket, 71 bytes
```
(require net/url)(port->string(get-pure-port(string->url"http://ai")))
```
[Answer]
# Kdb+, ~~34~~ 15 bytes
**KDB+ >= 3.4**
```
 q).Q.hg`http://ai
```
from [here](http://code.kx.com/wiki/DotQ/DotQDothg).
**KDB+ < 3.4**
```
q)`:http://ai"GET / HTTP/1.0",4#"\n"
"HTTP/1.1 200 OK\r\nDate: Thu, 11 May 2017 21:45:01 GMT\r\nServer: Apache/1.3..
```
[Answer]
# [J](http://jsoftware.com/), 33 bytes
Sadly, this only works on the J shell.
[![J HTTP demo](https://i.stack.imgur.com/icQNs.png)](https://i.stack.imgur.com/icQNs.png)
```
load 'web/gethttp'
gethttp 'g.co'
```
[Answer]
# HTML, 24 bytes
```
<iframe src="http://ai">
```
This technically fails as it renders the result...
[Answer]
# Vim, 2 + 12 = 14 bytes
```
gf
```
Expects the URL `http://3.ly/` as input. `gf` opens the current file under the cursor. Thanks to netrw, this works fine for URLs. I found this just now while trying to remember the command to open URLs in your browser (found it, it's [`gx`](https://stackoverflow.com/a/9459366/2093695)).
[Answer]
## PowerShell, 62 bytes
PowerShell 5
```
-join[char[]][net.webclient]::new().downloaddata('http://ai.')
```
66 bytes for more older versions of PowerShell
```
-join[char[]](new-object net.webclient).downloaddata('http://ai.')
```
[Answer]
# Python + requests, ~~55~~ ~~53~~ 50 bytes
```
from requests import*
print(get('http://ai').text)
```
-2 bytes by switching URLs
-3 bytes thanks to ovs
[Answer]
# [AHK](https://autohotkey.com/), 31 bytes
```
URLDownloadToFile,http://g.co,g
```
There's a built-in so it's not very exciting. Try to fashion, though, the function is fairly long.
[Answer]
## Bash + wget, 7 bytes
```
wget ai
```
Downloads the page at <http://ai>
[Answer]
## Ruby, 27 + 10 = 37 bytes
```
puts open('http://ai').read
```
+10 bytes for `-ropen-uri` flag (to require open-uri library)
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 + 11 = 15 bytes
```
jk'z
```
With URL `http://v.ht` as input. Takes an URL string as input, downloads the file, and prints its content.
Explanation:
```
jk'z
   z    Get the input string (URL)
  '     Download the file from the URL, return a list of lines
jk      Join the list on k which is the empty string
```
Note that we cannot use the function `s` for concatenating the list because of bytes types issues.
**Slightly cheating, 2 + 11 = 13 bytes** (it displays the list of the lines in the file instead of a single string for the whole file):
```
'z
```
You will need to install Pyth on your machine to test it (the online interpreter does not execute unsafe operations).
[Answer]
## C#, 76 bytes
```
Console.WriteLine(new System.Net.WebClient().DownloadString("http://3.ly"));
```
[Answer]
## MATLAB, 20 bytes
```
urlread('http://ai')
```
Nothing fancy here...
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
```
.w
```
Beats all other answers. Takes `ai` as input.
]