Link to home
Start Free TrialLog in
Avatar of tulung
tulung

asked on

CGI

i need a cgi that can save an URL output to a file! but this cgi must not using LWP libs or others lib!
examples:
input ot this cgi is http://www.geocities.com/cgi-bin/members?id=tulung
and then the cgi save the html output from this url to a file.
but this cgi must not using any libs! (pleaseeee...)
can anyone help me?.. please...
Avatar of sdjjm
sdjjm

I don't understand what it is you are trying to do.  Are you trying to take the output from an HTML form and save it in a file via a CGI?  Or are you trying to take the output from one of Geocities' CGI scripts and save that data to a file?
Avatar of tulung

ASKER

correct!... i want to take an output of HTML and saved to a file via a CGI, GEOCITIES Cgi Script is only an example!
This will take the output from an HTML form and put it in a file for you...

#!/usr/local/bin/perl
&parse;
open (LOGFILE, ">>yourfile.log");
$newline=join('::',@value);
print LOGFILE ("$newline\n");
close LOGFILE;
exit;
sub parse {
read(STDIN,$user_string,$ENV{'CONTENT_LENGTH'});
if (length($ENV{'QUERY_STRING'})>0) {$user_string=$ENV{'QUERY_STRING'}};
$user_string =~ s/\+/ /g;
@name_value_pairs = split(/&/,$user_string);
foreach $name_value_pair (@name_value_pairs) {
        ($keyword,$value) = split(/=/,$name_value_pair);
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge;
        push(@value, "$value");
        $user_data{$keyword} = $value;
        };
};

Avatar of tulung

ASKER

I thing you don't understand what i want.
If we type an url in a browser, the browser will show an html.
now i want a cgi, that if we input an url (get or POST method) the cgi will redirect to the url, and then the cgi will save the html that should be shown to a file.
are you still not understand?

let's we talk about others examples,
i want my cgi save the www.microsoft.com html!, i can save the html by visiting the site and then with my browser i choose file/save as. but i want my cgi to do it! do i don't need to enter the www.microsoft.com to save the html of www.microsoft.com site!
and of course this cgi must be working to url such as
http://www.tripod.com/cgi-bin/members?id=tulung

so when i enter this url, the cgi will search the url and then the cgi will save the html that generated by the tripod cgi!

JUST like GET (LWP lib), but i don't this script using this lib or others lib!..

i'm sorry about my bad grammer!

Thanks

You really made this impossible by not allowing the use of a library.  The problem that you have is that you need the cgi on whatever server is processing the cgi to open an http: connection to another site.  Such http connections need libraries, at least they do when written in anything normal, like C, C++, Perl, shell-script, etc.  

If you have access to C or any other real language you could reverse engineer such a library and make the http connection that you need but really this is like using the library in the first place.  

I assume that you do not want to use a library because you server will not allow you to load them.  If this is the case they are unlikely to be silly enough to give you the power to make your own.  SO you are out of luck.
Avatar of tulung

ASKER

i'm using win32 platfom, and i don't know how to use lib in perl for win32, you may help me!
i have libwww 4.0, but i don't know how to use it! so i try to ask, did there is another way to do that!

NO!

This is what we are trying to tell you!
Avatar of tulung

ASKER

ok, now i change my question, how to use lib in perl for win32?
i have libwww 4.0 but i don't know how to use it, can you explain it to me, how to install a lib so i can use the lib?
must be specific cause i don't know how to install it!

ASKER CERTIFIED SOLUTION
Avatar of sdjjm
sdjjm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial