Navigation

Operators and Keywords

Function List:

C++ API

urlwrite.cc File Reference

#include <string>
#include <fstream>
#include <iomanip>
#include "file-ops.h"
#include "file-stat.h"
#include "oct-env.h"
#include "defun-dld.h"
#include "error.h"
#include "oct-obj.h"
#include "ov-cell.h"
#include "pager.h"
#include "unwind-prot.h"

Include dependency graph for urlwrite.cc:


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 if 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 (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 if 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 ( urlread  ,
args  ,
nargout   
)

DEFUN_DLD ( urlwrite  ,
args  ,
nargout   
)