URLSave

URLSave["url"]
saves the content of the URL to a file in $TemporaryDirectory.

URLSave["url","file"]
saves the content of the URL to a file.

URLSave["url","file",elements]
returns the specified elements from a URL.

Details and OptionsDetails and Options

  • Types of elements supported:
  • "Headers"a list of all headers received from the URL
    "Cookies"a list of all known cookies
    "StatusCode"the status code returned by the server
  • The following forms of element specifications can be given:
  • "elem"return a single element
    {elem1,elem2,}return several elements
    {"Rules",{elem1,elem2,}}return several elements as a list of rules
    "Rules"return all possible elements as a list of rules
    "All"return all possible elements as a list
  • The following options can be given:
  • Method"GET"method to use for request
    "Parameters"{}parameters to be sent for the request
    "Body"""contents of message body to be sent
    "MultipartElements"{}list of multipart data elements to send
    "Username"""username to use for the request
    "Password"""password to use for the request
    "Headers"{}headers to be manually sent to the HTTP server
    "Cookies"Truewhether to store received cookies
    "StoreCookies"Automaticcookies to pass to the server
    "VerifyPeer"Trueverify authenticity using SSL certificates
    "UserAgent"Automaticuser agent string to send
    "ReadTimeout"0time to allow for uploading or downloading data
    "ConnectTimeout"0time to allow for connecting to the server
    BinaryFormatTruewhether to avoid textual interpretation of newlines or other data
    "FollowRedirects"Truewhether to follow redirects

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

This saves the content of the URL:

In[1]:=
Click for copyable input
Out[1]=

Download a file and check the status code returned from the server:

In[1]:=
Click for copyable input
Out[1]=

Gather information about a connection:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2012
(9.0)