strange query.

2002-07-17 Thread James Campbell

Hi Everyone

I'm having a spot of bother with a query string.

The program below attempts to mimic a web form. It should post the value of
'QUERY ..' to the cgi in $location.

What is actually happening is that 'QUERY ..' itself is being sent as the
value. I copied the name 'QUERY ..' from the textarea name on the original
web form.

I have tried character escaping the space and the two dots but that didn't
work (the cgi hung). 
Maybe I need to use CGI.pm to generate the query string?
Anyone got any ideas?
Thanks
James

--

#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request;

#This is the sequence for analysis (it is actually all on one line!!!)
my Seq='MQMRVLRIQHPLDHRPRHDRKTRHEVMLPDRKTRDLVVAIRNDRRA
  LRIGAHIQAMPVFRRVQIERRRGVRRMHVADALLNQLRGLRMQFQRHAERGRR
  ALTRVVVRRGADAARGEHDVSRGERAPQRRRDALGVVADVLRPAERQPTRAEQ
  FDNLRQMLVDPPARQDLIAAKCHCRLFRLVSNSSVGNRRRVPHAAVLFR
  AHALQRAQTV';

#Send the request
my $location = http://www.sbc.su.se/~miklos/DAS/tmdas.cgi;;
my $agent = new LWP::UserAgent;
my $req = new HTTP::Request POST = $location;
  $req - header('Accept' = 'text/html');
  $req - header('Accept' = 'image/gif');
  $req - header('Accept' = 'text/plain');
  $req - header('Content-Type' = 'application/x-www-form-urlencoded');
  $req - content('QUERY ..' = $seq);


#Receive the response
my $result = $agent-request( $req );
   print $result-headers_as_string;
   print $result-content;





James Campbell
Tel:+44-(0)207-848-5111
Email: [EMAIL PROTECTED]
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  

'Where shall I begin, please your Majesty?' He asked
'Begin at the beggining,' the King said gravely, 'and go on 
till you come to the end: then stop.'

Lewis Carroll, Alice's Adventures in Wonderland.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: strange query.

2002-07-17 Thread Yasen Petrov

Use double quotes (  ) for surrounding, instead of apostrophy ( ' ). Thus
it will interpret it and not translate it litterally.


--

Best Wishes,
Yasen Petrov
ICQ 163 671 835

James Campbell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Everyone

 I'm having a spot of bother with a query string.

 The program below attempts to mimic a web form. It should post the value
of
 'QUERY ..' to the cgi in $location.

 What is actually happening is that 'QUERY ..' itself is being sent as the
 value. I copied the name 'QUERY ..' from the textarea name on the original
 web form.

 I have tried character escaping the space and the two dots but that didn't
 work (the cgi hung).
 Maybe I need to use CGI.pm to generate the query string?
 Anyone got any ideas?
 Thanks
 James

 --

 #!/usr/bin/perl -w
 use strict;
 use LWP::UserAgent;
 use HTTP::Request;

 #This is the sequence for analysis (it is actually all on one line!!!)
 my Seq='MQMRVLRIQHPLDHRPRHDRKTRHEVMLPDRKTRDLVVAIRNDRRA
   LRIGAHIQAMPVFRRVQIERRRGVRRMHVADALLNQLRGLRMQFQRHAERGRR
   ALTRVVVRRGADAARGEHDVSRGERAPQRRRDALGVVADVLRPAERQPTRAEQ
   FDNLRQMLVDPPARQDLIAAKCHCRLFRLVSNSSVGNRRRVPHAAVLFR
   AHALQRAQTV';

 #Send the request
 my $location = http://www.sbc.su.se/~miklos/DAS/tmdas.cgi;;
 my $agent = new LWP::UserAgent;
 my $req = new HTTP::Request POST = $location;
   $req - header('Accept' = 'text/html');
   $req - header('Accept' = 'image/gif');
   $req - header('Accept' = 'text/plain');
   $req - header('Content-Type' =
'application/x-www-form-urlencoded');
   $req - content('QUERY ..' = $seq);


 #Receive the response
 my $result = $agent-request( $req );
print $result-headers_as_string;
print $result-content;





 James Campbell
 Tel: +44-(0)207-848-5111
 Email: [EMAIL PROTECTED]
  =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

 'Where shall I begin, please your Majesty?' He asked
 'Begin at the beggining,' the King said gravely, 'and go on
 till you come to the end: then stop.'

 Lewis Carroll, Alice's Adventures in Wonderland.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: strange query.

2002-07-17 Thread John W. Krahn

James Campbell wrote:
 
 Hi Everyone

Hello,

 I'm having a spot of bother with a query string.
 
 The program below attempts to mimic a web form. It should post the value of
 'QUERY ..' to the cgi in $location.
 
 What is actually happening is that 'QUERY ..' itself is being sent as the
 value. I copied the name 'QUERY ..' from the textarea name on the original
 web form.
 
 I have tried character escaping the space and the two dots but that didn't
 work (the cgi hung).
 Maybe I need to use CGI.pm to generate the query string?
 Anyone got any ideas?

According to Ethereal the actual prefix sent is 'QUERY+..='


HTH

John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]