File: Networking-Utilities.html

package info (click to toggle)
octave3.2 3.2.4-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 62,936 kB
  • ctags: 37,353
  • sloc: cpp: 219,497; fortran: 116,336; ansic: 10,264; sh: 5,508; makefile: 4,245; lex: 3,573; yacc: 3,062; objc: 2,042; lisp: 1,692; awk: 860; perl: 844
file content (117 lines) | stat: -rw-r--r-- 6,412 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html lang="en">
<head>
<title>Networking Utilities - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities">
<link rel="prev" href="File-Archiving-Utilities.html#File-Archiving-Utilities" title="File Archiving Utilities">
<link rel="next" href="Controlling-Subprocesses.html#Controlling-Subprocesses" title="Controlling Subprocesses">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Networking-Utilities"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Controlling-Subprocesses.html#Controlling-Subprocesses">Controlling Subprocesses</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="File-Archiving-Utilities.html#File-Archiving-Utilities">File Archiving Utilities</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a>
<hr>
</div>

<h3 class="section">34.4 Networking Utilities</h3>

<!-- ./DLD-FUNCTIONS/urlwrite.cc -->
<p><a name="doc_002durlread"></a>

<div class="defun">
&mdash; Loadable Function: <var>s</var> = <b>urlread</b> (<var>url</var>)<var><a name="index-urlread-2363"></a></var><br>
&mdash; Loadable Function: [<var>s</var>, <var>success</var>] = <b>urlread</b> (<var>url</var>)<var><a name="index-urlread-2364"></a></var><br>
&mdash; Loadable Function: [<var>s</var>, <var>success</var>, <var>message</var>] = <b>urlread</b> (<var>url</var>)<var><a name="index-urlread-2365"></a></var><br>
&mdash; Loadable Function: [<small class="dots">...</small>] = <b>urlread</b> (<var>url, method, param</var>)<var><a name="index-urlread-2366"></a></var><br>
<blockquote><p>Download a remote file specified by its <var>URL</var> and return its content
in string <var>s</var>.  For example,

     <pre class="example">          s = urlread ("ftp://ftp.octave.org/pub/octave/README");
</pre>
        <p>The variable <var>success</var> is 1 if the download was successful,
otherwise it is 0 in which case <var>message</var> contains an error
message.  If no output argument is specified and if an error occurs,
then the error is signaled through Octave's error handling mechanism.

        <p>This function uses libcurl.  Curl supports, among others, the HTTP,
FTP and FILE protocols.  Username and password may be specified in the
URL.  For example,

     <pre class="example">          s = urlread ("http://user:password@example.com/file.txt");
</pre>
        <p>GET and POST requests can be specified by <var>method</var> and <var>param</var>. 
The parameter <var>method</var> is either &lsquo;<samp><span class="samp">get</span></samp>&rsquo; or &lsquo;<samp><span class="samp">post</span></samp>&rsquo;
and <var>param</var> is a cell array of parameter and value pairs. 
For example,

     <pre class="example">          s = urlread ("http://www.google.com/search", "get",
                       {"query", "octave"});
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002durlwrite.html#doc_002durlwrite">urlwrite</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/urlwrite.cc -->
   <p><a name="doc_002durlwrite"></a>

<div class="defun">
&mdash; Loadable Function:  <b>urlwrite</b> (<var>URL, localfile</var>)<var><a name="index-urlwrite-2367"></a></var><br>
&mdash; Loadable Function: <var>f</var> = <b>urlwrite</b> (<var>url, localfile</var>)<var><a name="index-urlwrite-2368"></a></var><br>
&mdash; Loadable Function: [<var>f</var>, <var>success</var>] = <b>urlwrite</b> (<var>url, localfile</var>)<var><a name="index-urlwrite-2369"></a></var><br>
&mdash; Loadable Function: [<var>f</var>, <var>success</var>, <var>message</var>] = <b>urlwrite</b> (<var>url, localfile</var>)<var><a name="index-urlwrite-2370"></a></var><br>
<blockquote><p>Download a remote file specified by its <var>URL</var> and save it as
<var>localfile</var>.  For example,

     <pre class="example">          urlwrite ("ftp://ftp.octave.org/pub/octave/README",
                    "README.txt");
</pre>
        <p>The full path of the downloaded file is returned in <var>f</var>.  The
variable <var>success</var> is 1 if the download was successful,
otherwise it is 0 in which case <var>message</var> contains an error
message.  If no output argument is specified and if an error occurs,
then the error is signaled through Octave's error handling mechanism.

        <p>This function uses libcurl.  Curl supports, among others, the HTTP,
FTP and FILE protocols.  Username and password may be specified in
the URL, for example:

     <pre class="example">          urlwrite ("http://username:password@example.com/file.txt",
                    "file.txt");
</pre>
        <p>GET and POST requests can be specified by <var>method</var> and <var>param</var>. 
The parameter <var>method</var> is either &lsquo;<samp><span class="samp">get</span></samp>&rsquo; or &lsquo;<samp><span class="samp">post</span></samp>&rsquo;
and <var>param</var> is a cell array of parameter and value pairs. 
For example:

     <pre class="example">          urlwrite ("http://www.google.com/search", "search.html",
                    "get", {"query", "octave"});
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002durlread.html#doc_002durlread">urlread</a>. 
</p></blockquote></div>

   </body></html>