ReceiveFtpFile: Difference between revisions

From Opale Wiki
Jump to navigation Jump to search
(Created page with " This command executes HTTP method on the specified GSM port. It requires an active connection to HTTP server on the specified GSM port. HTTP method can be GET, PUT, DELETE or POST. Input file path is used for PUT and POST methods, output file path is used for GET, DELETE and POST methods. If any of required parameter is not needed it can be specified as NULL string (""). Optional HTTP header name and value should be specified always in pair. Up to 12 HTTP headers...")
Tag: 2017 source edit
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:


This command executes HTTP method on the specified GSM port.  
This command receives a specified file from FTP server on the specified GSM port.


It requires an active connection to HTTP server on the specified GSM port.
It requires a already opened FTP session on the specified GSM port.  


HTTP method can be GET, PUT, DELETE or POST. Input file path is used for PUT and POST methods, output file path is used for GET, DELETE and POST methods.
Command waits until file is received or optional timeout (entered in seconds) expired.
 
If any of required parameter is not needed it can be specified as NULL string ("").
 
Optional HTTP header name and value should be specified always in pair. Up to 12 HTTP headers can be specified.
 
Command waits until data is transferred or timer expires.


'''COMMAND'''
'''COMMAND'''
Line 18: Line 12:
!Returns
!Returns
|-
|-
|ExecuteHttpMethod
|'''ReceiveFtpFile'''
|PortIndex, HTTPMethod, URL, UserName, Password, FilePath, ListPairsHTTPHeaderName-HTTPHeaderValue
|PortIndex, RemoteFileName, LocalFileName, [Timeout]
|[[R2D2 Error Codes|Error Code]] in case of error.
|File saved in specified local file name, [[R2D2 Error Codes|Error Code]] in case of error.
|}
|}


Line 29: Line 23:
'''EXAMPLE''' <syntaxhighlight lang="text">
'''EXAMPLE''' <syntaxhighlight lang="text">


~# ExecuteHttpMethod 0 GET www.acme.com "user" "pass" """/tmp/test/url.html" "Accept" "text/html" "Transfer-coding" "compress"
~# ReceiveFtpFile 0 "./test.dat" "/mnt/sdcard/tmp/test.dat" 120
OK
FILE RECEIVED


~# ExecuteHttpMethod 0 GET www.acme.com "user" "wrongpass" """/tmp/test/url.html" "Accept" "text/html" "Transfer-coding" "compress"
~# ReceiveFtpFile 0 "./test.dot" "/mnt/sdcard/tmp/test.dat"
AUTHENTICATION FAILED
FILE NOT FOUND


~# ExecuteHttpMethod 1 GET www.acme.com "" "" "" "/tmp/test/url.html" "Accept"
~# ReceiveFtpFile 1 "./test.dat" "/mnt/sdcard/tmp/test.dat"
BAD PARAMETERS
FTP DISCONNECTED


~# ExecuteHttpMethod 0 POST www.acme.com "user" "pass" "/tmp/test/put.htm" "/tmp/test/url.html" "Accept" "text/html" "Transfer-coding" "compress"
~# ReceiveFtpFile 1 "./test.dat" "/mnt/sdcard/tmp/test.dat"
OK
TIMEOUT EXPIRED
</syntaxhighlight>
</syntaxhighlight>
[[Category:R2D2]]
[[Category:R2D2]]
[[Category:DATA]]
[[Category:DATA]]

Latest revision as of 19:54, 1 April 2025

This command receives a specified file from FTP server on the specified GSM port.

It requires a already opened FTP session on the specified GSM port.

Command waits until file is received or optional timeout (entered in seconds) expired.

COMMAND

Command Line Arguments Returns
ReceiveFtpFile PortIndex, RemoteFileName, LocalFileName, [Timeout] File saved in specified local file name, Error Code in case of error.

OUTPUT

Success or Error Message (See Data Commands Messages)

EXAMPLE

~# ReceiveFtpFile 0 "./test.dat" "/mnt/sdcard/tmp/test.dat" 120
FILE RECEIVED

~# ReceiveFtpFile 0 "./test.dot" "/mnt/sdcard/tmp/test.dat"
FILE NOT FOUND

~# ReceiveFtpFile 1 "./test.dat" "/mnt/sdcard/tmp/test.dat"
FTP DISCONNECTED

~# ReceiveFtpFile 1 "./test.dat" "/mnt/sdcard/tmp/test.dat"
TIMEOUT EXPIRED