Code Comments
Programming Forum and web based access to our favorite programming groups.I need to create a perl script that basically loads a web page, asks for a Username and stores it as "Username". Also, it takes the domain name of the site (that runs the script) and stores that in "Domain". Next it does a substition: http://www.anothersite.com/whatever...ame&var2=Domain And forwards the user to that url. I'm a total newbie here. Can someone hack up a quick script based on this requirement? I'm going to do some string limits later, but I need some template to start with as I'm completely stuck. Thanks!
Post Follow-up to this message[removed non-existant groups, set followups to c.l.p.m] "Shabam" <blislecp@hotmail.com> wrote in message news:hcSdnc3upp6EQAncRVn-oA@adelphia.com... > I need to create a perl script that basically loads a web page, asks for a Define "loads a web page". Are you running a script that will retrieve a webpage, or are you creating a CGI script running on some web server? Option 1: perldoc LWP::Simple Option 2: perldoc CGI > Username and stores it as "Username". Also, it takes the domain name of the > site (that runs the script) and stores that in "Domain". > > Next it does a substition: perldoc perlre > > http://www.anothersite.com/whatever...ame&var2=Domain > > And forwards the user to that url. perldoc LWP::Simple > I'm a total newbie here. http://learn.perl.org > Can someone hack up a quick script based on this > requirement? http://jobs.perl.org > I'm going to do some string limits later, but I need some > template to start with as I'm completely stuck. Thanks! You're quite welcome. Paul Lalli
Post Follow-up to this messageShabam wrote: > I need to create a perl script that basically loads a web page, perldoc LWP > asks > for a Username perldoc -f print perldoc perlop (pretty far down in the section about "I/O Operators") > and stores it as "Username". Also, it takes the Now, where and how do you want to store that? In a file? In a database? What kind of database? Just not enough information... > domain name of the site (that runs the script) and stores that in > "Domain". > > Next it does a substition: > http://www.anothersite.com/whatever...ame&var2=Domain I suppose this is meant to be result of the substitution? What is the original string? Not enough information... > And forwards the user to that url. ??? Do you mean you want to open a browser program and load that page? perldoc -f system perldoc -f exec > I'm a total newbie here. Can someone hack up a quick script based on > this requirement? Can probably yes, want to unlikely. If you are looking for ready-made scripts you came to the wrong place. Show us what you have and many people here will be happy to help you with the next step. jue
Post Follow-up to this message> Now, where and how do you want to store that? In a file? In a database? What > kind of database? Just not enough information... Very basic. Just in memory is fine. > > I suppose this is meant to be result of the substitution? What is the > original string? Not enough information... I just need it to substitute the "Username" and "Domain" into the string, and redirect the user to that url. The "http://www.anothersite.com/whatever.cgi" part of it is hardcoded. > Do you mean you want to open a browser program and load that page? > perldoc -f system > perldoc -f exec No. I mean this whole script is running as a cgi on a web page. It takes the username that the user enters, and based on the domain name that the cgi script is running from, gets the other variable (Domain). Then, it redirects the user to the url http://www.anothersite.com/whatever...me&var2=Domain.
Post Follow-up to this messageShabam wrote: [...] > No. I mean this whole script is running as a cgi on a web page. Oh, a stealth CGI question. Good by then. jue
Post Follow-up to this message> Oh, a stealth CGI question. > Good by then. What are you talking about? It's a simple web page cgi. User enters "Username", and the page takes that, along with the domain name from the server, and redirects the user to another script. This is being used for an order system for hosting, so that the user gets http://username.domain.com as their address. The billing system I'm using now doesn't support such a mechanism natively, as it accepts full domain names only. Thus I need to do it this way. I'm guessing you think I'm trying to do something bad. Don't assume, without any basis.
Post Follow-up to this messageOn 2004-11-12, Shabam <blislecp@hotmail.com> wrote: > > What are you talking about? It's a simple web page cgi. [snip] > I'm guessing you think I'm trying to do something bad. Don't assume, > without any basis. I think the only bad thing he thinks you may be doing is asking a question about CGI in a Perl newsgroup. Contrary to unfortunately popular belief, CGI and Perl are not the same thing. CGI is an interface, programs for which can be written in various languages (including) Perl. If your question would be no different if you were programming in, for instance, C, you probably want to look at a group that has cgi in its name instead. dha -- David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/ Nice DNS error you have there. - subbes
Post Follow-up to this messageShabam wrote: > No. I mean this whole script is running as a cgi on a web page. It takes > the username that the user enters, and based on the domain name that the c gi > script is running from, gets the other variable (Domain). Then, it > redirects the user to the url > http://www.anothersite.com/whatever...me&var2=Domain. my $server_host = $ENV{HTTP_HOST}; (my $domain = $server_host) =~ s/^www\.//'; # Gross assumption my $username = some basic CGI processing here. print "$redirect_url?var1=$username;var2=$domain"; For the 'some basic CGI processing here', you should go ask in one of the CGI newsgroups, as the solution is not perl-specific. -Joe
Post Follow-up to this messageShabam wrote: > > I'm guessing you think I'm trying to do something bad. Not at all. We think you're asking a basic CGI question in a perl language newsgroup instead of in a CGI-oriented newsgroup. That's what 'stealth CGI question' means. We're here to help, after you've written some perl code. You'll find that these newsgroups are not the place to go for a beginner's guide to CGI programming. -Joe
Post Follow-up to this message[newsgroups trimmed] Quoth "Shabam" <blislecp@hotmail.com>: > > What are you talking about? It's a simple web page cgi. User enters > "Username", and the page takes that, along with the domain name from the > server, and redirects the user to another script. This is being used for an > order system for hosting, so that the user gets http://username.domain.com > as their address. The billing system I'm using now doesn't support such a > mechanism natively, as it accepts full domain names only. Thus I need to do > it this way. > > I'm guessing you think I'm trying to do something bad. Don't assume, > without any basis. LOL! No, he meant that your question was actually about CGI, but you didn't say so. Questions like that are not welcome here: we get too many of them, and they're not interesting. Ben -- Like all men in Babylon I have been a proconsul; like all, a slave ... Durin g one lunar year, I have been declared invisible; I shrieked and was not heard , I stole my bread and was not decapitated. ~ ben@morrow.me.uk ~ Jorge Luis Borges, 'The Babylon Lotte ry'
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.