URLSave

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 used when connecting to an HTTP server
    "Parameters"{}parameters to be sent to the HTTP server
    "VerifyPeer"Trueverify the authenticity of a remote server using SSL certificates
    "Username"""connect to an HTTP server with a certain username
    "Password"""connect to an HTTP server with a certain password
    "UserAgent"Automaticchange the user agent sent to an HTTP server
    "Cookies"Automaticcookie management is Automatic or may be handled manually by passing a list of cookies
    "StoreCookies"Trueif True, cookies will be stored in a global cookie share
    "Headers"{}headers to be manually sent to the HTTP server
    "BodyData"""contents of the message body to be sent to the server
    "MultipartData"{}to upload multipart data, each part must be of the form , where {bytes} is a list of bytes
    BinaryFormatTrueif True, the file is opened in binary format, so that no textual interpretation of newlines or other data is done
    "ReadTimeout"0the maximum allowed time in seconds to download or upload data to the server
    "ConnectTimeout"0the maximum allowed time in seconds to connect to the server

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]=
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »