LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2003, 03:07 AM   #1
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Rep: Reputation: 30
Unhappy PHP/PERL Solution


I'm a Unix C programmer, with an intermediate knowledge in shell scripting as well. PHP and perl are something new to me - something which i have to discover yet.

I always needed to solve a personal problem but i didn't know how - The problem is to be able to automatically fill in a web-page form and send it automatically by means of a program. Recently some friends told me that 'they think' that it can be done by PHP or perl.

Which solution do you advise me to adopt - PHP or perl? I'm looking for the quickest (and thus intelligent) solution, before doing my research on that particular language to be able to solve the problem.

PS: This is not a PHP vs perl war, ok guys?

Regards,
Ganni.
 
Old 09-12-2003, 04:04 AM   #2
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
I just got an email about this very thing:


This is a daily mailing from the Perl FAQ a Day website.
For subscription info, or to have your address removed from
the mailing list, please see http://perl.faq-by-day.org/

Question:
How do I automate an HTML form submission?

If you're submitting values using the GET method, create a URL and
encode the form using the `query_form' method:

use LWP::Simple;
use URI::URL;

my $url = url('http://www.perl.com/cgi-bin/cpan_mod');
$url->query_form(module => 'DB_File', readme => 1);
$content = get($url);

If you're using the POST method, create your own user agent and
encode the content appropriately.

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

$ua = LWP::UserAgent->new();
my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
[ module => 'DB_File', readme => 1 ];
$content = $ua->request($req)->as_string;


--
 
Old 09-12-2003, 04:39 AM   #3
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
"use LWP, use URI.."

That means that i need to install those 2 libraries?
 
Old 09-12-2003, 05:33 AM   #4
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Rep: Reputation: 30
I have to ask, this web form you want to fill in.
I assume it is one of your own creation, if so why not just use the data you would have placed on the form, pass it straight into either PHP or Perl mail function and do it that way.
 
Old 09-12-2003, 05:59 AM   #5
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
No, Andy - the website residing the form is not mine. My idea was to use a web-based SMS service (for members only) to use a script to send an SMS. The site is http://www.go.com.mt but can be anything afaik. So after filling the account number and password, the script must also fill another form (which will load on another page) to fill the recepients mobile phone number and the actual sms message. So that's the concept :P
 
Old 09-12-2003, 07:06 AM   #6
Andy@DP
Member
 
Registered: Aug 2003
Posts: 208

Rep: Reputation: 30
OK so I think the best advice I can give would be to look at faking the send like m0rl0ck suggested.
Find the HTML for the form, find out the method (GET/POST) and the fields that are sent to what URL and make a script which will fake all this and send it to the above URL.

I couldn't find the form on the site BTW, any chance of the URL for the form.
 
Old 09-12-2003, 07:40 AM   #7
ganninu
Member
 
Registered: Jul 2003
Distribution: RH 7.3/8.0/9.0, Debian Stable 3.0, FreeBSD 5.2, Solaris 8/9/10,HP-UX
Posts: 340

Original Poster
Rep: Reputation: 30
Yeah infact that's the best/easiest thing that had to be done.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and Perl ---Help please ridge321 Linux - Newbie 1 02-10-2005 08:01 PM
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
Solution to ALL MySQL, PHP, Apache2 problems in SuSE SuSE_fan Linux - Software 5 06-03-2004 08:07 AM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM
perl/php help Syncrm Programming 1 10-22-2001 05:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration