473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Managing multiple HTTP requests on same session

12
Hi,

I am trying to write a script that simulate a nevigation on a particular web site.
Before I am getting the page that contains the information I need, I have to go through a series of preceding pages.

The page flow is as follow: login page -> page1 -> page2 ..etc.

The problem is that once I am doing the login to the webside and requesting for the next page, the web server doesn't recongnize me anymore. The response I get is that the login has expired. Therefore I am not getting the actual html on this page and I cannot move forward to the next page in the flow.

I guess that the web server doesn't recognize two subsequent requests as coming from the same session.

I tried to use a few packages of perl: LWP:UserAgent, POE:Component:Client:HTTP. Unfortunately, I couldn't solve that.

Do you have any idea ?

Thanks,
Ido.
Feb 21 '08 #1
2 2660
KevinADC
4,059 Expert 2GB
I am pretty sure WWW::Mechanize can do this as long as there is no javascript invloved. Read the documentation and read any FAQS or Cookbooks that are also posted/linked to on CPAN. I can not help with WWW::Mechanize usage as I have no experience with the module.
Feb 21 '08 #2
Kelicula
176 Expert 100+
Are you saving the cookies, that the remote site is sending you, and sending them back?
More than likely the remote site has sent you a cookie after the "login" page, which you're script will have to save and send back to the server, on all future request, just like a regular browser.

Here is an example server/client comm. with cookies.


Expand|Select|Wrap|Line Numbers
  1. client:
  2. GET www.somepage.com HTTP/1.1
  3. Host: localhost
  4. Accept: image/gif, image/x-bitmap, image/jpg, */*
  5. Connection: Keep-Alive
  6.  
  7. Server:
  8. HTTP/1.1 200 OK
  9. Date: Sat, 18 Mar 2008 20:35:35 GMT
  10. Server: Apache/1.3.9 (Unix)
  11. Set-Cookie: user_id=123456; path=/; expires=Sat, 18-Mar-05 19:06:19 GMT
  12.  
  13.  
  14. Then on all future request, client should echo:
  15. GET /somepage.html HTTP1.1
  16. Host: localhost
  17. Accept: image/gif, image/jpeg, */*
  18. Connection: Keep-Alive
  19. Cookie: user_id=123456
  20.  
  21.  
  22.  
Feb 22 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
1
by: SPG | last post by:
Hi, I have a servlet application that I am trying to write a very basic load tester for. There application has several servlets, but all rely on the same session being used (IE: For logged in...
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
0
by: AIMTech | last post by:
We have an IIS+ASP based application server that is capable of providing complex reports to hundreds of users but in some circumstances these reports can take a long time to create. However the...
7
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user...
18
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
7
by: blueapricot416 | last post by:
Hello helpful computer people! I can't seem to get more than one request to fire simultaneously... and I have read there should be at least 2 possible (in IE) and more in Firefox. I made a...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
9
by: mosscliffe | last post by:
I am struggling to find a python example of the scenario - I have. I have a python script, which generates a page with a search button (actually an input field). The data from the above...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.