Functions

urlwrite.cc File Reference

#include <string>
#include <fstream>
#include <iomanip>
#include <iostream>
#include "dir-ops.h"
#include "file-ops.h"
#include "file-stat.h"
#include "oct-env.h"
#include "glob-match.h"
#include "defun-dld.h"
#include "error.h"
#include "oct-obj.h"
#include "ov-cell.h"
#include "pager.h"
#include "oct-map.h"
#include "oct-refcount.h"
#include "unwind-prot.h"
Include dependency graph for urlwrite.cc:

Go to the source code of this file.

Functions

 DEFUN_DLD (urlwrite, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} urlwrite (@var{url}, @var{localfile})\n\ @deftypefnx {Loadable Function} {@var{f} =} urlwrite (@var{url}, @var{localfile})\n\ @deftypefnx {Loadable Function} {[@var{f}, @var{success}] =} urlwrite (@var{url}, @var{localfile})\n\ @deftypefnx {Loadable Function} {[@var{f}, @var{success}, @var{message}] =} urlwrite (@var{url}, @var{localfile})\n\ Download a remote file specified by its @var{url} and save it as\n\ @var{localfile}. For example:\n\ \n\ @example\n\ @group\n\ urlwrite (\"ftp://ftp.octave.org/pub/octave/README\",\n\ \"README.txt\");\n\ @end group\n\ @end example\n\ \n\ The full path of the downloaded file is returned in @var{f}. The\n\ variable @var{success} is 1 if the download was successful,\n\ otherwise it is 0 in which case @var{message} contains an error\n\ message. If no output argument is specified and an error occurs,\n\ then the error is signaled through Octave's error handling mechanism.\n\ \n\ This function uses libcurl. Curl supports, among others, the HTTP,\n\ FTP and FILE protocols. Username and password may be specified in\n\ the URL, for example:\n\ \n\ @example\n\ @group\n\ urlwrite (\"http://username:password@@example.com/file.txt\",\n\ \"file.txt\");\n\ @end group\n\ @end example\n\ \n\ GET and POST requests can be specified by @var{method} and @var{param}.\n\ The parameter @var{method} is either @samp{get} or @samp{post}\n\ and @var{param} is a cell array of parameter and value pairs.\n\ For example:\n\ \n\ @example\n\ @group\n\ urlwrite (\"http://www.google.com/search\", \"search.html\",\n\ \"get\", @{\"query\", \"octave\"@});\n\ @end group\n\ @end example\n\ @seealso{urlread}\n\ @end deftypefn")
 DEFUN_DLD (__ftp_mget__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_mget__ (@var{handle}, @var{files})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_mput__, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_mput__ (@var{handle}, @var{files})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_rename__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_rename__ (@var{handle}, @var{path})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_mkdir__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_mkdir__ (@var{handle}, @var{path})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_rmdir__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_rmdir__ (@var{handle}, @var{path})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_delete__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_delete__ (@var{handle}, @var{path})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_mode__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_mode__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_close__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_close__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_binary__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_binary__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_ascii__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_ascii__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_dir__, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_dir__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_cwd__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_cwd__ (@var{handle}, @var{path})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp_pwd__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp_pwd__ (@var{handle})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (__ftp__, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} __ftp__ (@var{handle}, @var{host})\n\ @deftypefnx {Loadable Function} {} __ftp__ (@var{handle}, @var{host}, @var{username}, @var{password})\n\ Undocumented internal function\n\ @end deftypefn")
 DEFUN_DLD (urlread, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{s} =} urlread (@var{url})\n\ @deftypefnx {Loadable Function} {[@var{s}, @var{success}] =} urlread (@var{url})\n\ @deftypefnx {Loadable Function} {[@var{s}, @var{success}, @var{message}] =} urlread (@var{url})\n\ @deftypefnx {Loadable Function} {[@dots{}] =} urlread (@var{url}, @var{method}, @var{param})\n\ Download a remote file specified by its @var{url} and return its content\n\ in string @var{s}. For example:\n\ \n\ @example\n\ s = urlread (\"ftp://ftp.octave.org/pub/octave/README\");\n\ @end example\n\ \n\ The variable @var{success} is 1 if the download was successful,\n\ otherwise it is 0 in which case @var{message} contains an error\n\ message. If no output argument is specified and an error occurs,\n\ then the error is signaled through Octave's error handling mechanism.\n\ \n\ This function uses libcurl. Curl supports, among others, the HTTP,\n\ FTP and FILE protocols. Username and password may be specified in the\n\ URL@. For example:\n\ \n\ @example\n\ s = urlread (\"http://user:password@@example.com/file.txt\");\n\ @end example\n\ \n\ GET and POST requests can be specified by @var{method} and @var{param}.\n\ The parameter @var{method} is either @samp{get} or @samp{post}\n\ and @var{param} is a cell array of parameter and value pairs.\n\ For example:\n\ \n\ @example\n\ @group\n\ s = urlread (\"http://www.google.com/search\", \"get\",\n\ @{\"query\", \"octave\"@});\n\ @end group\n\ @end example\n\ @seealso{urlwrite}\n\ @end deftypefn")

Function Documentation

DEFUN_DLD ( urlwrite  ,
args  ,
nargout   
)
DEFUN_DLD ( __ftp_mget__  ,
args   
)
DEFUN_DLD ( __ftp_mput__  ,
args  ,
nargout   
)
DEFUN_DLD ( __ftp_rename__  ,
args   
)

Definition at line 1377 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_mkdir__  ,
args   
)

Definition at line 1344 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_rmdir__  ,
args   
)

Definition at line 1311 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_delete__  ,
args   
)

Definition at line 1278 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_mode__  ,
args   
)

Definition at line 1244 of file urlwrite.cc.

References error(), and error_state.

DEFUN_DLD ( __ftp_close__  ,
args   
)

Definition at line 1219 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_binary__  ,
args   
)

Definition at line 1187 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_ascii__  ,
args   
)

Definition at line 1155 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_dir__  ,
args  ,
nargout   
)

Definition at line 1075 of file urlwrite.cc.

References octave_map::assign(), error(), error_state, and Array< T >::length().

DEFUN_DLD ( __ftp_cwd__  ,
args   
)

Definition at line 1039 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( __ftp_pwd__  ,
args   
)

Definition at line 1006 of file urlwrite.cc.

References error(), and error_state.

DEFUN_DLD ( __ftp__  ,
args   
)

Definition at line 964 of file urlwrite.cc.

References error(), error_state, and octave_value().

DEFUN_DLD ( urlread  ,
args  ,
nargout   
)

Definition at line 845 of file urlwrite.cc.

References error(), error_state, Array< T >::numel(), and print_usage().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines