FrankS: FileUpload auf Client automatisieren

Beitrag lesen

Hallo Sven!

Das ich das Script schlussendlich als Cronjob laufen lasse ist klar.

dacht ich mir...

»»  (ftp faellt Flach).
Warum? Es gibt auch für FTP im Perl Module. Und einen Kommadozeilen-FTP-Client kann man doch auch so schön per commadfile steuern:
ftp -s:ftpcmd

und in ftpcmd steht:
open DeinHost
username
password
chdir irgendwas
put file
bye

Gibt es in Perl dafuer vorgefertigte Funktionen?  (Wahrscheinlich ja)

Ja, auch dafür gibts Module. Ich kopiere einfach mal ein Auszug aus Perl in a Nutshell:

<cite>
17.3 The HTTP Modules

The HTTP modules implement an interface to the HTTP messaging protocol used in web transactions. Its most useful modules are HTTP::Request and HTTP::Response,
which create objects for client requests and server responses. Other modules provide means for manipulating headers, interpreting server response codes, managing
cookies, converting date formats, and creating basic server applications.

Client applications created with LWP::UserAgent use HTTP::Request objects to create and send requests to servers. The information returned from a server is saved as
an HTTP::Response object. Both of these objects are subclasses of HTTP::Message, which provides general methods of creating and modifying HTTP messages. The
header information included in HTTP messages can be represented by objects of the HTTP::Headers class.

HTTP::Status includes functions to classify response codes into the categories of informational, successful, redirection, error, client error, or server error. It also exports
symbolic aliases of HTTP response codes; one could refer to the status code of 200 as RC_OK and refer to 404 as RC_NOT_FOUND.

17.3.1 HTTP::Request

This module summarizes a web client's request. For a simple GET request, you define an object with the GET method and assign a URL to apply it to. Basic headers
would be filled in automatically by LWP. For a POST or PUT request, you might want to specify a custom HTTP::Headers object for the request, or use the
contents of a file for an entity body. Since HTTP::Request inherits everything in HTTP::Message, you can use the header and entity body manipulation methods from
HTTP::Message in HTTP::Request objects.

The constructor for HTTP::Request looks like this:

$req = http::Request->new (method, url, [$header, [content]]);

The method and URL values for the request are required parameters. The header and content arguments are not required, nor even necessary for all requests. The
parameters are described as follows:

method

A string specifying the HTTP request method. GET, HEAD, and POST are the most commonly used. Other methods defined in the HTTP specification such
     as PUT and DELETE are not supported by most servers.

url

The address and resource name of the information you are requesting. This argument may be either a string containing an absolute URL (the hostname is required),
     or a URI::URL object that stores all the information about the URL.

$header

A reference to an HTTP::Headers object.

content

A scalar that specifies the entity body of the request. If omitted, the entity body is empty.

The HTTP::Date module converts date strings from and to machine time. The HTTP::Daemon module can be used to create webserver applications, utilizing the
functionality of the rest of the LWP modules to communicate with clients.
</cite>

Und wenn Du Perl installiert hast, dann tipp mal perldoc lwp ein, dann bekommst du Hilfe zu LWP (Library for WWW access in Perl).

Gruß Frank

P.S. ich schicke Dir das einfach mal per Mail, es sprengt den Rahmen des Forums