Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

cgi-perl

by tja_ariani (Acolyte)
on Aug 07, 2003 at 09:51 UTC ( [id://281814]=perlquestion: print w/replies, xml ) Need Help??

tja_ariani has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I need to create a website which may open tcp/ip connection to another server and submit/send files. I was thinking to use CGI at the website to invoke a Perl program that will then open the tcp/ip cnx. Is it possible? I am looking for some samples of how to do this for some time but can't find any answer from the web or book. Pls help me. Thx

Replies are listed 'Best First'.
Re: cgi-perl
by liz (Monsignor) on Aug 07, 2003 at 09:56 UTC
    Maybe you need LWP::UserAgent?

    Your problem description is not very clear.

    Liz

      Ok, ill try to elaborate more. I already installed an apache server, for cgi and webserver. Now I want to build a website where people/public can submit their file.But this file need to be send to another server (not the webserver). So I was thinking to write a program in perl that opens tcp/ip conx when it is triggered by smt from the website to the destinated server. But I don't have any idea of where to start learning. Learned about how to create a tcp conx in perl but don't know how to continue then.
        So you have the following steps:
        1. get a file from a submitter
        2. send that file to another server
        About 1: I assume you already use Apache::Request to get the file into a temporary directory.

        So that leaves 2: the problem of sending the file to that other server. Is that other server also running a webserver? Or an FTP-server? Or what?

        If the other server is a web-server, why don't you post the result of your form there so that the file is stored there immediately?

        If that is not possible, and it is running a web-server that allows file uploads, the LWP::UserAgent should do the trik for you. If the other server is an FTP-server, then I guess Net::FTP would be something to look at.

        Hope this helps. Still not 100% sure what you're trying to do.

        Liz

Re: cgi-perl
by teabag (Pilgrim) on Aug 07, 2003 at 10:32 UTC
    hi tja_ariani

    It looks to me like you want to ftp the files, right?
    You could try Net::FTP, as liz suggested for your problem. Build some kind of webbased interface which logs on to the server you want to ftp to, or make an ftp dir on the server that users login to and use a cronjob f.i. to move the files, or make it "trigger another script".

    You might have to solve some ownership issues and limit the filesize and/or maximum amount of uploads. You could look at some simple uploadscripts and build it based up on that.


    Teabag
    Sure there's more than one way, but one just needs one anyway - Teabag

      Hi, thanks a lot for ur help. But I'm still confused of which module should I start first from, and how to "trigger another script" Could you tell me some of the simple uploadscripts available. so that I can learn and build based on that

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://281814]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-19 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found