Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 13th, 2008, 2:21 PM   #1
Johnmcter
Newbie
 
Join Date: Feb 2008
Posts: 1
Rep Power: 0 Johnmcter is on a distinguished road
LWP form Data array issues

ok, I hate to be some noob who shows up asking for help on their first post, but here goes it. I'm using LWP to post some form data, and have everything working fine, I'm running into issues with how this data is handled when coming from a seperate file though. The seperate data is listed as

    'beta' => 'info',
    'charly' => 'here',
    'alpha' => 'something',

Everything works great if I pass it within the script to the array as such

@form_data = (
    'beta' => 'info',
    'charly' => 'here',
    'alpha' => 'something',
);

But when grabbing as outlined below I get these semi colons, and it isn't processing them in my http headers, things also appear to be alphabetical

Content-Type: application/x-www-form-urlencoded

    'alpha' => 'something',
:     'beta' => 'info', 
    'charly' => 'here',

a sample script is below
#!/usr/bin/perl -w
use LWP::UserAgent;

my $browser = LWP::UserAgent->new( );
my @custom_headers = (
  'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)',
  'Accept-Language' => 'en',
  'Accept' =>
   "text/html, text/plain, text/css, text/sgml, */*",
);

 open (FORMFILE, "$dir/$formfile");
 @form_data = <FORMFILE>; 
 close(FORMFILE);

 open (INFO, "file.txt");
 @temparray = <INFO>;
 close(INFO);

 $post_url = "http://www.somesite.com/something";
 $post_html = "post.html";


 my $post_response = $browser->post($post_url, @form_data, @custom_headers, ':content_file' => $post_html,);

Last edited by Johnmcter; Feb 13th, 2008 at 2:22 PM. Reason: clarrity
Johnmcter is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble inputing data to an Array Jarod Silverstar Java 4 Dec 2nd, 2006 2:19 PM
entering data into excel from a form glevine Perl 1 Nov 18th, 2005 5:03 PM
How to read unknown total of int data from text file to a 2-dim array in C ladyscarlet99 C 2 Sep 9th, 2005 2:28 AM
How to read unknown total of int data from text file to a 2-dim array in C++? ladyscarlet99 C++ 2 Sep 9th, 2005 1:01 AM
Installing IPB 2.03 bh4575 Other Web Development Languages 0 Apr 23rd, 2005 2:36 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:03 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC