Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Script to pass info to GET string
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!



Report this thread to moderator Post Follow-up to this message
Old Post
Shabam
11-12-04 08:55 PM


Re: Script to pass info to GET string
[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


Report this thread to moderator Post Follow-up to this message
Old Post
Paul Lalli
11-12-04 08:55 PM


Re: Script to pass info to GET string
Shabam 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



Report this thread to moderator Post Follow-up to this message
Old Post
Jürgen Exner
11-12-04 08:55 PM


Re: Script to pass info to GET string
> 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.




Report this thread to moderator Post Follow-up to this message
Old Post
Shabam
11-12-04 08:55 PM


Re: Script to pass info to GET string
Shabam 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



Report this thread to moderator Post Follow-up to this message
Old Post
Jürgen Exner
11-12-04 08:55 PM


Re: Script to pass info to GET string
> 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.



Report this thread to moderator Post Follow-up to this message
Old Post
Shabam
11-12-04 08:55 PM


Re: Script to pass info to GET string
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
David H. Adler
11-13-04 01:55 AM


Re: Script to pass info to GET string
Shabam 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

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Smith
11-14-04 01:55 PM


Re: Script to pass info to GET string
Shabam 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

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Smith
11-14-04 01:55 PM


Re: Script to pass info to GET string
[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'

Report this thread to moderator Post Follow-up to this message
Old Post
Ben Morrow
11-14-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

PERL Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:36 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.